Package org.sonar.php.tree.visitors
Class PHPCheckContext
java.lang.Object
org.sonar.php.tree.visitors.PHPCheckContext
- All Implemented Interfaces:
RegexCheckContext,CheckContext
-
Constructor Summary
ConstructorsConstructorDescriptionPHPCheckContext(PhpFile file, CompilationUnitTree tree, File workingDirectory) PHPCheckContext(PhpFile file, CompilationUnitTree tree, File workingDirectory, SymbolTable symbolTable) PHPCheckContext(PhpInputFileContext fileContext, CompilationUnitTree tree, SymbolTable symbolTable) -
Method Summary
Modifier and TypeMethodDescriptionnewFileIssue(PHPCheck check, String message) To add cost useFileIssue.cost(double).newIssue(PhpRegexCheck check, org.sonarsource.analyzer.commons.regex.ast.RegexSyntaxElement regexTree, String message) To add secondary locations and cost usePreciseIssue.secondary(Tree, String)andPreciseIssue.cost(double).To add secondary locations and cost usePreciseIssue.secondary(Tree, String)andPreciseIssue.cost(double).newIssue(PHPCheck check, IssueLocation issueLocation) Report an issue with precise issue location based on lines and columns without relaying on tree elementsnewLineIssue(PHPCheck check, int line, String message) To add cost useLineIssue.cost(double).org.sonarsource.analyzer.commons.regex.RegexParseResultregexForLiteral(org.sonarsource.analyzer.commons.regex.ast.FlagSet initialFlags, LiteralTree stringLiteral) tree()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.sonar.plugins.php.api.visitors.CheckContext
getFramework
-
Constructor Details
-
PHPCheckContext
-
PHPCheckContext
public PHPCheckContext(PhpFile file, CompilationUnitTree tree, @Nullable File workingDirectory, SymbolTable symbolTable) -
PHPCheckContext
public PHPCheckContext(PhpInputFileContext fileContext, CompilationUnitTree tree, SymbolTable symbolTable)
-
-
Method Details
-
tree
- Specified by:
treein interfaceCheckContext- Returns:
- the top tree node of the current file AST representation.
-
newIssue
Description copied from interface:CheckContextTo add secondary locations and cost use
PreciseIssue.secondary(Tree, String)andPreciseIssue.cost(double). Note, that these calls could be chained.newIssue(myCheck, primaryTree, "Primary message") .secondary(secondaryTree1, "Secondary message") .secondary(secondaryTree2, null) .cost(3);- Specified by:
newIssuein interfaceCheckContext- Parameters:
check- the instance of the rule for which issue should be createdtree- primary location for issuemessage- primary message of the issue- Returns:
- issue with precise location
-
newIssue
Description copied from interface:CheckContextTo add secondary locations and cost use
PreciseIssue.secondary(Tree, String)andPreciseIssue.cost(double). Note, that these calls could be chained.newIssue(myCheck, primaryLocationStartTree, primaryLocationEndTree, "Primary message") .secondary(secondaryTree1, "Secondary message") .secondary(secondaryTree2, null) .cost(3);- Specified by:
newIssuein interfaceCheckContext- Parameters:
check- the instance of the rule for which issue should be createdstartTree- start of this tree will be the start of primary location of the issueendTree- end of this tree will be the end of primary location of the issuemessage- primary message of the issue- Returns:
- issue with precise location
-
newIssue
public PreciseIssue newIssue(PhpRegexCheck check, org.sonarsource.analyzer.commons.regex.ast.RegexSyntaxElement regexTree, String message) - Specified by:
newIssuein interfaceRegexCheckContext
-
newIssue
Description copied from interface:CheckContextReport an issue with precise issue location based on lines and columns without relaying on tree elements- Specified by:
newIssuein interfaceCheckContext- Parameters:
check- the instance of the rule for which issue should be createdissueLocation- issue location within a file including the location message- Returns:
- issue with precise location
-
regexForLiteral
public org.sonarsource.analyzer.commons.regex.RegexParseResult regexForLiteral(org.sonarsource.analyzer.commons.regex.ast.FlagSet initialFlags, LiteralTree stringLiteral) - Specified by:
regexForLiteralin interfaceRegexCheckContext
-
newLineIssue
Description copied from interface:CheckContextTo add cost use
LineIssue.cost(double).newLineIssue(myCheck, 42, "Message") .cost(3);- Specified by:
newLineIssuein interfaceCheckContext- Parameters:
check- the instance of the rule for which issue should be createdline- position of the issue in the filemessage- message of the issue- Returns:
- issue with line location
-
newFileIssue
Description copied from interface:CheckContextTo add cost use
FileIssue.cost(double).newFileIssue(myCheck, "Message") .cost(3);- Specified by:
newFileIssuein interfaceCheckContext- Parameters:
check- the instance of the rule for which issue should be createdmessage- message of the issue- Returns:
- issue at file level
-
getPhpFile
- Specified by:
getPhpFilein interfaceCheckContext- Returns:
- the current file
-
getIssues
- Specified by:
getIssuesin interfaceCheckContext
-
symbolTable
- Specified by:
symbolTablein interfaceCheckContext
-
getWorkingDirectory
- Specified by:
getWorkingDirectoryin interfaceCheckContext
-
cacheContext
- Specified by:
cacheContextin interfaceCheckContext
-