use of org.sonar.commonruleengine.Issue in project sonar-go by SonarSource.
the class TestUtils method analyze.
private static SingleFileVerifier analyze(Check check, Path testFile, UastNode uast) throws IOException {
TestInputFileBuilder inputFile = TestInputFileBuilder.create("test", testFile.getParent().toFile(), testFile.toFile());
inputFile.setContents(new String(Files.readAllBytes(testFile), StandardCharsets.UTF_8));
inputFile.setCharset(StandardCharsets.UTF_8);
Engine engine = new Engine(Collections.singletonList(check));
List<Issue> issues = engine.scan(uast, inputFile.build()).issues;
SingleFileVerifier verifier = SingleFileVerifier.create(testFile, StandardCharsets.UTF_8);
uast.getDescendants(UastNode.Kind.COMMENT, comment -> verifier.addComment(comment.token.line, comment.token.column, comment.token.value, 2, 0));
issues.forEach(issue -> reportIssueTo(verifier, issue));
return verifier;
}
Aggregations