Class InternalIssueVerifier

    • Constructor Detail

      • InternalIssueVerifier

        public InternalIssueVerifier​(Path mainSourceFilePath,
                                     Charset encoding)
    • Method Detail

      • addComment

        public InternalIssueVerifier addComment​(Path path,
                                                int line,
                                                int column,
                                                String content,
                                                int prefixLength,
                                                int suffixLength)
        Description copied from interface: MultiFileVerifier
        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);
          }
         
        Specified by:
        addComment in interface MultiFileVerifier
        Parameters:
        path - path of the source code
        line - start at 1, beginning of the comment
        column - start at 1, beginning of the comment prefix
        content - content of the comment with prefix and suffix
        prefixLength - for example, if the prefix is '//' then the length is 2
        suffixLength - for example, if the suffix is '-->' then the length is 3
      • addComment

        public InternalIssueVerifier addComment​(int line,
                                                int column,
                                                String content,
                                                int prefixLength,
                                                int suffixLength)
        Description copied from interface: SingleFileVerifier
        Should be called for all comment of the analyzed source file. Example:
          void visitComment(CommentToken token) {
            verifier.addComment(token.line(), token.column(), token.text(), COMMENT_PREFIX_LENGTH, COMMENT_SUFFIX_LENGTH);
          }
         
        Specified by:
        addComment in interface SingleFileVerifier
        Parameters:
        line - start at 1, beginning of the comment
        column - start at 1, beginning of the comment prefix
        content - content of the comment with prefix and suffix
        prefixLength - for example, if the prefix is '//' then the length is 2
        suffixLength - for example, if the suffix is '-->' then the length is 3
      • reportIssue

        public org.sonarsource.analyzer.commons.checks.verifier.internal.InternalIssue reportIssue​(Path path,
                                                                                                   String message)
        Description copied from interface: MultiFileVerifier
        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");
         
        Specified by:
        reportIssue in interface MultiFileVerifier
        Parameters:
        path - path of the source code file that has the issue
        message - issue message
      • reportIssue

        public org.sonarsource.analyzer.commons.checks.verifier.internal.InternalIssue reportIssue​(String message)
        Description copied from interface: SingleFileVerifier
        Each issue raised by a rule should be reported using this method.
           verifier.reportIssue("Issue on file").onFile();
        
           verifier.reportIssue("Issue on line").onLine(line);
        
           verifier.reportIssue("Issue on range with a secondary location").onRange(line, column, endLine, endColumn)
             .addSecondary(secondary.line, secondary.column, secondary.endLine, secondary.endColumn, "Secondary message");
         
        Specified by:
        reportIssue in interface SingleFileVerifier
        Parameters:
        message - issue message