Package org.sonar.java.testing
Class JavaFileScannerContextForTests
java.lang.Object
org.sonar.java.model.DefaultJavaFileScannerContext
org.sonar.java.testing.JavaFileScannerContextForTests
- All Implemented Interfaces:
RegexScannerContext,FluentReporting,JavaFileScannerContext
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.sonar.java.reporting.FluentReporting
FluentReporting.JavaIssueBuilderNested classes/interfaces inherited from interface org.sonar.plugins.java.api.JavaFileScannerContext
JavaFileScannerContext.Location -
Constructor Summary
ConstructorsConstructorDescriptionJavaFileScannerContextForTests(CompilationUnitTree tree, org.sonar.api.batch.fs.InputFile inputFile, Sema semanticModel, SonarComponents sonarComponents, JavaVersion javaVersion, boolean failedParsing, boolean inAndroidContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidReport an issue on a specific line.voidaddIssueOnProject(JavaCheck javaCheck, String message) Report an issue at at the project level.createAnalyzerMessage(JavaCheck javaCheck, Tree startTree, String message) newIssue()voidreportIssue(AnalyzerMessage message) voidreportIssue(JavaCheck javaCheck, Tree tree, String message) Report an issue.voidreportIssue(JavaCheck javaCheck, Tree syntaxNode, String message, List<JavaFileScannerContext.Location> secondary, Integer cost) Report an issue.voidreportIssue(JavaCheck javaCheck, Tree startTree, Tree endTree, String message) Report an issue.voidreportIssue(JavaCheck javaCheck, Tree startTree, Tree endTree, String message, List<JavaFileScannerContext.Location> secondary, Integer cost) Report an issue.voidreportIssueWithFlow(JavaCheck javaCheck, Tree syntaxNode, String message, Iterable<List<JavaFileScannerContext.Location>> flows, Integer cost) Report an issue.Methods inherited from class org.sonar.java.model.DefaultJavaFileScannerContext
addIssue, addIssueOnFile, createAnalyzerMessage, fileParsed, getComplexityNodes, getFileContent, getFileLines, getInputFile, getJavaVersion, getProject, getSemanticModel, getTree, getWorkingDirectory, inAndroidContext, regexForLiterals, reportIssue, reportIssue, sourceMap, throwIfEndOfAnalysisCheck
-
Constructor Details
-
JavaFileScannerContextForTests
public JavaFileScannerContextForTests(CompilationUnitTree tree, org.sonar.api.batch.fs.InputFile inputFile, Sema semanticModel, @Nullable SonarComponents sonarComponents, JavaVersion javaVersion, boolean failedParsing, boolean inAndroidContext)
-
-
Method Details
-
getIssues
-
getQuickFixes
-
addIssueOnProject
Description copied from interface:JavaFileScannerContextReport an issue at at the project level.- Specified by:
addIssueOnProjectin interfaceJavaFileScannerContext- Overrides:
addIssueOnProjectin classDefaultJavaFileScannerContext- Parameters:
javaCheck- The check raising the issue.message- Message to display to the user
-
addIssue
Description copied from interface:JavaFileScannerContextReport an issue on a specific line. PreferJavaFileScannerContext.reportIssue(JavaCheck, Tree, String, List, Integer)for more precise reporting.- Specified by:
addIssuein interfaceJavaFileScannerContext- Overrides:
addIssuein classDefaultJavaFileScannerContext- Parameters:
line- line on which to report the issuejavaCheck- The check raising the issue.message- Message to display to the usercost- computed remediation cost if applicable, null if not.
-
reportIssue
Description copied from interface:JavaFileScannerContextReport an issue.- Specified by:
reportIssuein interfaceJavaFileScannerContext- Overrides:
reportIssuein classDefaultJavaFileScannerContext- Parameters:
javaCheck- check raising the issuetree- syntax node on which to raise the issue.message- Message to display to the user.
-
reportIssue
public void reportIssue(JavaCheck javaCheck, Tree syntaxNode, String message, List<JavaFileScannerContext.Location> secondary, @Nullable Integer cost) Description copied from interface:JavaFileScannerContextReport an issue.- Specified by:
reportIssuein interfaceJavaFileScannerContext- Overrides:
reportIssuein classDefaultJavaFileScannerContext- Parameters:
javaCheck- check raising the issuesyntaxNode- syntax node on which to raise the issue.message- Message to display to the user.secondary- List ofJavaFileScannerContext.Locationto display secondary location for the issue.cost- computed remediation cost if applicable, null if not.
-
reportIssue
Description copied from interface:JavaFileScannerContextReport an issue.- Specified by:
reportIssuein interfaceJavaFileScannerContext- Overrides:
reportIssuein classDefaultJavaFileScannerContext- Parameters:
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.
-
reportIssue
public void reportIssue(JavaCheck javaCheck, Tree startTree, Tree endTree, String message, List<JavaFileScannerContext.Location> secondary, @Nullable Integer cost) Description copied from interface:JavaFileScannerContextReport an issue.- Specified by:
reportIssuein interfaceJavaFileScannerContext- Overrides:
reportIssuein classDefaultJavaFileScannerContext- Parameters:
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.secondary- List ofJavaFileScannerContext.Locationto display secondary location for the issue.cost- computed remediation cost if applicable, null if not.
-
reportIssueWithFlow
public void reportIssueWithFlow(JavaCheck javaCheck, Tree syntaxNode, String message, Iterable<List<JavaFileScannerContext.Location>> flows, @Nullable Integer cost) Description copied from interface:JavaFileScannerContextReport an issue.- Specified by:
reportIssueWithFlowin interfaceJavaFileScannerContext- Overrides:
reportIssueWithFlowin classDefaultJavaFileScannerContext- Parameters:
javaCheck- check raising the issuesyntaxNode- syntax node on which to raise the issue.message- Message to display to the user.flows- List of list ofJavaFileScannerContext.Locationto display flows for the issue.cost- computed remediation cost if applicable, null if not.
-
reportIssue
- Overrides:
reportIssuein classDefaultJavaFileScannerContext
-
createAnalyzerMessage
- Overrides:
createAnalyzerMessagein classDefaultJavaFileScannerContext
-
newIssue
- Specified by:
newIssuein interfaceFluentReporting- Overrides:
newIssuein classDefaultJavaFileScannerContext
-