Class CobolAstCheck

  • All Implemented Interfaces:
    AstVisitor, org.sonar.squid.api.CodeCheck, org.sonar.squid.api.CodeVisitor

    @Deprecated
    public abstract class CobolAstCheck
    extends CobolCheck
    implements org.sonar.squid.api.CodeCheck
    Deprecated.
    (it will be removed in version 5.0) inherit from CobolCheck and use CobolCheck.reportIssue(String), see bellow @deprecated comments for more details
    Base class to implement a Cobol check. A check is simply a CobolAstVisitor with some additional methods to log violations.
    • Constructor Detail

      • CobolAstCheck

        public CobolAstCheck()
        Deprecated.
    • Method Detail

      • log

        @Deprecated
        protected void log​(String messageText,
                           AstNode node,
                           Object... messageParameters)
        Deprecated.
        Use:
           If "messageParameters" exists, format the message using: 
        String message = MessageFormat.format(messageText, messageParameters);
        To still report at line level, use:
        Token token = node.getToken();
        reportIssue(message).atLine(token.getFile(), token.getLine());
        To benefit from precise location, use:
        reportIssue(message).on(node);
        Log a violation on an AstNode
        Parameters:
        messageText - message to log
        node - AST node associated to this message. Used to associate the message to a line number.
        messageParameters - option message's parameters (see the java.text.MessageFormat class of the java API)
      • log

        @Deprecated
        protected void log​(String messageText,
                           Token token,
                           Object... messageParameters)
        Deprecated.
        Use:
           If "messageParameters" exists, format the message using: 
        String message = MessageFormat.format(messageText, messageParameters);
        To still report at line level, use:
        reportIssue(message).atLine(token.getFile(), token.getLine());
        To benefit from precise location, use:
        reportIssue(message).on(token);
        Log a violation on a Token
        Parameters:
        messageText - message to log
        token - token associated to this message. Used to associate the message to a line number.
        messageParameters - option message's parameters (see the java.text.MessageFormat class of the java API)
      • log

        @Deprecated
        protected final void log​(String messageText,
                                 int line,
                                 Object... messageParameters)
        Deprecated.
        Use:
           If "messageParameters" exists, format the message using: 
        String message = MessageFormat.format(messageText, messageParameters);
        Report the issue:
        reportIssue(message).atLine(line);
        Log a violation on a line
        Parameters:
        messageText - message to log
        line - line number to associate this violation to. if the line value is < 0, the violation is just associated to the source file.
        messageParameters - option message's parameters (see the java.text.MessageFormat class of the java API)
      • log

        @Deprecated
        protected final void log​(@Nullable
                                 File copybookFile,
                                 String messageText,
                                 int line,
                                 Object... messageParameters)
        Deprecated.
        Use:
           If "messageParameters" exists, format the message using: 
        String message = MessageFormat.format(messageText, messageParameters);
        Report the issue:
        reportIssue(message).atLine(copybookFile, line);
        Log a violation on a line of a copybook
        Parameters:
        copybookFile - copybook file
        messageText - message to log
        line - line number to associate this violation to. if the line value is < 0, the violation is just associated to the source file.
        messageParameters - option message's parameters (see the java.text.MessageFormat class of the java API)
      • logOnTokenWithCost

        @Deprecated
        protected void logOnTokenWithCost​(Token token,
                                          @Nullable
                                          Double cost,
                                          String messageText,
                                          Object... messageParameters)
        Deprecated.
        Use:
           If "messageParameters" exists, format the message using: 
        String message = MessageFormat.format(messageText, messageParameters);
        To still report at line level, use:
        reportIssue(message).atLine(token.getFile(), token.getLine()).withGap(cost);
        To benefit from precise location, use:
        reportIssue(message).on(token).withGap(cost);
        Log a violation with a remediation cost on a Token. Token can belong to both COBOL program file and copybook.
        Parameters:
        token - token associated to this message. Used to associate the message to a line number.
        cost - remediation cost
        messageText - message to log
        messageParameters - option message's parameters (see the java.text.MessageFormat class of the java API)
      • logWithCost

        @Deprecated
        protected void logWithCost​(AstNode node,
                                   @Nullable
                                   Double cost,
                                   String messageText,
                                   Object... messageParameters)
        Deprecated.
        Use:
           If "messageParameters" exists, format the message using: 
        String message = MessageFormat.format(messageText, messageParameters);
        To still report at line level, use:
        Token token = node.getToken();
        reportIssue(message).atLine(token.getFile(), token.getLine()).withGap(cost);
        To benefit from precise location, use:
        reportIssue(message).on(node).withGap(cost);
        Log a violation with a remediation cost on an AstNode. AstNode can belong to both COBOL program file and copybook.
        Parameters:
        node - AST node associated to this message. Used to associate the message to a line number.
        cost - remediation cost
        messageText - message to log
        messageParameters - option message's parameters (see the java.text.MessageFormat class of the java API)
      • logWithCost

        @Deprecated
        protected final void logWithCost​(int line,
                                         @Nullable
                                         Double cost,
                                         String messageText,
                                         Object... messageParameters)
        Deprecated.
        Use:
           If "messageParameters" exists, format the message using: 
        String message = MessageFormat.format(messageText, messageParameters);
        Report the issue:
        reportIssue(message).atLine(line).withGap(cost);
        Log a violation with a remediation cost on a line of COBOL program file
        Parameters:
        line - line number to associate this violation to. if the line value is < 0, the violation is just associated to the source file.
        cost - remediation cost
        messageText - message to log
        messageParameters - option message's parameters (see the java.text.MessageFormat class of the java API)
      • getKey

        @Deprecated
        public final String getKey()
        Deprecated.
        not used, return getClass().getSimpleName() (it will be removed in version 5.0)
        Specified by:
        getKey in interface org.sonar.squid.api.CodeCheck
      • toClassCollection

        @Deprecated
        public static Collection<Class> toClassCollection​(CobolAstCheck[] checks)
        Deprecated.
        not used (it will be removed in version 5.0)
        Return the collection of check classes.
        Parameters:
        checks - the checks from which we want the collection of classes
        Returns:
        the collection of classes