@Beta
public interface JavaFileScannerContext
| Modifier and Type | Interface and Description |
|---|---|
static class |
JavaFileScannerContext.Location
Message and syntaxNode for a secondary location.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addIssue(File file,
JavaCheck check,
int line,
String message)
Report an issue at a specific line of a given file.
|
void |
addIssue(int line,
JavaCheck check,
String message)
Report an issue on a specific line.
|
void |
addIssue(int line,
JavaCheck check,
String message,
Integer cost)
Report an issue on a specific line.
|
void |
addIssueOnFile(JavaCheck check,
String message)
Report an issue at file level.
|
boolean |
fileParsed()
Checks if file has been parsed correctly.
|
List<Tree> |
getComplexityNodes(Tree tree)
Computes the list of syntax nodes which are contributing to increase the complexity for the given methodTree.
|
File |
getFile()
File under analysis.
|
String |
getFileContent()
Content of the currently analyzed file.
|
String |
getFileKey()
FileKey of currently analyzed file.
|
List<String> |
getFileLines()
Lines of the currently analyzed file.
|
JavaVersion |
getJavaVersion()
Java version defined for the analysis using sonar.java.version parameter.
|
List<Tree> |
getMethodComplexityNodes(ClassTree enclosingClass,
MethodTree methodTree)
Deprecated.
use
getComplexityNodes(Tree) instead |
Object |
getSemanticModel()
Get semantic analysis.
|
CompilationUnitTree |
getTree()
Parsed tree of the current file.
|
void |
reportIssue(JavaCheck javaCheck,
Tree tree,
String message)
Report an issue.
|
void |
reportIssue(JavaCheck javaCheck,
Tree tree,
String message,
List<JavaFileScannerContext.Location> secondaryLocations,
Integer cost)
Report an issue.
|
void |
reportIssue(JavaCheck javaCheck,
Tree startTree,
Tree endTree,
String message)
Report an issue.
|
void |
reportIssue(JavaCheck javaCheck,
Tree startTree,
Tree endTree,
String message,
List<JavaFileScannerContext.Location> secondaryLocations,
Integer cost)
Report an issue.
|
void |
reportIssueWithFlow(JavaCheck javaCheck,
Tree tree,
String message,
Iterable<List<JavaFileScannerContext.Location>> flows,
Integer cost)
Report an issue.
|
CompilationUnitTree getTree()
void addIssueOnFile(JavaCheck check, String message)
check - The check raising the issue.message - Message to display to the uservoid addIssue(int line,
JavaCheck check,
String message)
line - line on which to report the issuecheck - The check raising the issue.message - Message to display to the userJavaFileScannerContext#reportIssue(JavaCheck, Tree, String)} which should be prefered as reporting will be more precise.void addIssue(int line,
JavaCheck check,
String message,
@Nullable
Integer cost)
line - line on which to report the issuecheck - The check raising the issue.message - Message to display to the usercost - computed remediation cost if applicable, null if not.JavaFileScannerContext#reportIssue(JavaCheck, Tree, String, List, Integer)} which should be prefered as reporting will be more precise.void addIssue(File file, JavaCheck check, int line, String message)
file - File on which to reportcheck - The check raising the issue.line - line on which to report the issuemessage - Message to display to the user@Nullable Object getSemanticModel()
String getFileKey()
File getFile()
JavaVersion getJavaVersion()
boolean fileParsed()
List<Tree> getComplexityNodes(Tree tree)
tree - the tree to compute the complexity.@Deprecated List<Tree> getMethodComplexityNodes(ClassTree enclosingClass, MethodTree methodTree)
getComplexityNodes(Tree) insteadenclosingClass - not used.methodTree - the methodTree to compute the complexity.void reportIssue(JavaCheck javaCheck, Tree tree, String message)
javaCheck - check raising the issuetree - syntax node on which to raise the issue.message - Message to display to the user.void reportIssue(JavaCheck javaCheck, Tree tree, String message, List<JavaFileScannerContext.Location> secondaryLocations, @Nullable Integer cost)
javaCheck - check raising the issuetree - syntax node on which to raise the issue.message - Message to display to the user.secondaryLocations - List of JavaFileScannerContext.Location to display secondary location for the issue.cost - computed remediation cost if applicable, null if not.void reportIssueWithFlow(JavaCheck javaCheck, Tree tree, String message, Iterable<List<JavaFileScannerContext.Location>> flows, @Nullable Integer cost)
javaCheck - check raising the issuetree - syntax node on which to raise the issue.message - Message to display to the user.flows - List of list of JavaFileScannerContext.Location to display flows for the issue.cost - computed remediation cost if applicable, null if not.void reportIssue(JavaCheck javaCheck, Tree startTree, Tree endTree, String message)
javaCheck - check raising the issuestartTree - syntax node on which to start the highlighting of the issue.endTree - syntax node on which to end the highlighting of the issue.message - Message to display to the user.void reportIssue(JavaCheck javaCheck, Tree startTree, Tree endTree, String message, List<JavaFileScannerContext.Location> secondaryLocations, @Nullable Integer cost)
javaCheck - check raising the issuestartTree - syntax node on which to start the highlighting of the issue.endTree - syntax node on which to end the highlighting of the issue.message - Message to display to the user.secondaryLocations - List of JavaFileScannerContext.Location to display secondary location for the issue.cost - computed remediation cost if applicable, null if not.List<String> getFileLines()
String getFileContent()
Copyright © 2012–2017 SonarSource. All rights reserved.