Package com.sonarsource.cobol.api.ast
Class CobolAstCheck
- java.lang.Object
-
- com.sonarsource.cobol.api.ast.CobolAstVisitor
-
- com.sonarsource.cobol.api.ast.CobolCheck
-
- com.sonarsource.cobol.api.ast.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 useCobolCheck.reportIssue(String)
, see bellow @deprecated comments for more detailsBase class to implement a Cobol check. A check is simply a CobolAstVisitor with some additional methods to log violations.
-
-
Field Summary
-
Fields inherited from class com.sonarsource.cobol.api.ast.CobolAstVisitor
grammar
-
-
Constructor Summary
Constructors Constructor Description CobolAstCheck()
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getKey()
Deprecated.not used, return getClass().getSimpleName() (it will be removed in version 5.0)protected void
log(File copybookFile, String messageText, int line, Object... messageParameters)
Deprecated.Use:protected void
log(String messageText, int line, Object... messageParameters)
Deprecated.Use:protected void
log(String messageText, AstNode node, Object... messageParameters)
Deprecated.Use:protected void
log(String messageText, Token token, Object... messageParameters)
Deprecated.Use:protected void
logOnTokenWithCost(Token token, Double cost, String messageText, Object... messageParameters)
Deprecated.Use:protected void
logWithCost(int line, Double cost, String messageText, Object... messageParameters)
Deprecated.Use:protected void
logWithCost(AstNode node, Double cost, String messageText, Object... messageParameters)
Deprecated.Use:static Collection<Class>
toClassCollection(CobolAstCheck[] checks)
Deprecated.not used (it will be removed in version 5.0)-
Methods inherited from class com.sonarsource.cobol.api.ast.CobolCheck
reportIssue, setIssueRepository
-
Methods inherited from class com.sonarsource.cobol.api.ast.CobolAstVisitor
addSourceCode, destroy, getAstNodeTypesToVisit, getCharset, getCicsGrammar, getCobolFile, getCobolGrammar, getComments, getExecutionFlow, getFile, getSqlGrammar, getSymbolTable, init, leaveFile, leaveNode, peekSourceCode, popSourceCode, processMetrics, setCharset, setCobolFile, setComments, setExecutionFlow, setFile, setGrammar, setSourceCodeStack, setSymbolTable, subscribeTo, visitFile, visitNode
-
-
-
-
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 lognode
- 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 logtoken
- 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 logline
- 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 filemessageText
- message to logline
- 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 costmessageText
- message to logmessageParameters
- 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 costmessageText
- message to logmessageParameters
- 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 costmessageText
- message to logmessageParameters
- 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 interfaceorg.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
-
-