Interface MultiFileVerifier
-
- All Known Implementing Classes:
InternalIssueVerifier
public interface MultiFileVerifierExample:Path path = Paths.get("main.js"); MultiFileVerifier verifier = MultiFileVerifier.create(path, UTF_8); // use an AST visitor to add all the comment verifier.addComment(path, 12, 20, " Noncompliant {{Rule message}}", 2, 0); // report all issues raised by one rule verifier.reportIssue(path, "Issue on file").onFile(); verifier.reportIssue(path, "Issue on line").onLine(4); verifier.reportIssue(path, "Issue on range").onRange(9, 11, 9, 13) .addSecondary(path, 6, 9, 6, 11, "msg"); verifier.assertOneOrMoreIssues();Example 2:// to expect to issue, use: verifier.assertNoIssues();
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceMultiFileVerifier.Issuestatic interfaceMultiFileVerifier.IssueBuilderMust always call one and only one of: onFile, onLine, onRange
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description MultiFileVerifieraddComment(Path path, int line, int column, String content, int prefixLength, int suffixLength)Should be called for all comment of the analyzed source file.voidassertNoIssues()Run the comparison and expect to find no issue.voidassertOneOrMoreIssues()Run the comparison and expect to find at least one issue.static MultiFileVerifiercreate(Path mainSourceFilePath, Charset encoding)MultiFileVerifier.IssueBuilderreportIssue(Path path, String message)Each issue raised by a rule should be reported using this method.
-
-
-
Method Detail
-
create
static MultiFileVerifier create(Path mainSourceFilePath, Charset encoding)
- Parameters:
mainSourceFilePath-encoding- encoding used to load source file
-
addComment
MultiFileVerifier addComment(Path path, int line, int column, String content, int prefixLength, int suffixLength)
Should be called for all comment of the analyzed source file. Example:void visitComment(CommentToken token) { verifier.addComment(token.path(), token.line(), token.column(), token.text(), COMMENT_PREFIX_LENGTH, COMMENT_SUFFIX_LENGTH); }- Parameters:
path- path of the source codeline- start at 1, beginning of the commentcolumn- start at 1, beginning of the comment prefixcontent- content of the comment with prefix and suffixprefixLength- for example, if the prefix is '//' then the length is 2suffixLength- for example, if the suffix is '-->' then the length is 3
-
reportIssue
MultiFileVerifier.IssueBuilder reportIssue(Path path, String message)
Each issue raised by a rule should be reported using this method.verifier.reportIssue(path, "Issue on file").onFile(); verifier.reportIssue(path, "Issue on line").onLine(line); verifier.reportIssue(path, "Issue on range with a secondary location").onRange(line, column, endLine, endColumn) .addSecondary(secondary.line, secondary.column, secondary.endLine, secondary.endColumn, "Secondary message");- Parameters:
path- path of the source code file that has the issuemessage- issue message
-
assertOneOrMoreIssues
void assertOneOrMoreIssues()
Run the comparison and expect to find at least one issue.
-
assertNoIssues
void assertNoIssues()
Run the comparison and expect to find no issue.
-
-