Package org.sonar.java.checks.verifier
Class JavaCheckVerifier
- java.lang.Object
-
- org.sonar.java.checks.verifier.JavaCheckVerifier
-
@Beta public final class JavaCheckVerifier extends Object
It is possible to specify the absolute line number on which the issue should appear by appending "@<line>" to "Noncompliant". But usually better to use line number relative to the current, this is possible to do by prefixing the number with either '+' or '-'. For example:// Noncompliant@+1 {{do not import "java.util.List"}} import java.util.List;Full syntax:// Noncompliant@+1 [[startColumn=1;endLine=+1;endColumn=2;effortToFix=4;secondary=3,4]] {{issue message}}Attributes between [[]] are optional:- startColumn: column where the highlight starts
- endLine: relative endLine where the highlight ends (i.e. +1), same line if omitted
- endColumn: column where the highlight ends
- effortToFix: the cost to fix as integer
- secondary: a comma separated list of integers identifying the lines of secondary locations if any
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static CheckVerifiernewVerifier()static voidverify(String filename, JavaFileScanner check)Deprecated.usenewVerifier()insteadstatic voidverify(String filename, JavaFileScanner check, int javaVersion)Deprecated.usenewVerifier()insteadstatic voidverify(String filename, JavaFileScanner check, String testJarsDirectory)Deprecated.usenewVerifier()insteadstatic voidverify(String filename, JavaFileScanner check, Collection<File> classpath)Deprecated.usenewVerifier()insteadstatic voidverifyIssueOnFile(String filename, String message, JavaFileScanner check)Deprecated.usenewVerifier()insteadstatic voidverifyIssueOnProject(String filename, String message, JavaFileScanner check)Deprecated.usenewVerifier()insteadstatic voidverifyNoIssue(String filename, JavaFileScanner check)Deprecated.usenewVerifier()insteadstatic voidverifyNoIssue(String filename, JavaFileScanner check, int javaVersion)Deprecated.usenewVerifier()insteadstatic voidverifyNoIssueWithoutSemantic(String filename, JavaFileScanner check)Deprecated.usenewVerifier()insteadstatic voidverifyNoIssueWithoutSemantic(String filename, JavaFileScanner check, int javaVersion)Deprecated.usenewVerifier()instead
-
-
-
Method Detail
-
newVerifier
public static CheckVerifier newVerifier()
-
verify
@Deprecated public static void verify(String filename, JavaFileScanner check)
Deprecated.usenewVerifier()insteadVerifies that the provided file will raise all the expected issues when analyzed with the given check.
By default, any jar or zip archive present in the folder defined byJavaCheckVerifier#DEFAULT_TEST_JARS_DIRECTORYwill be used to add extra classes to the classpath. If this folder is empty or does not exist, then the analysis will be based on the source of the provided file.- Parameters:
filename- The file to be analyzedcheck- The check to be used for the analysis
-
verify
@Deprecated public static void verify(String filename, JavaFileScanner check, int javaVersion)
Deprecated.usenewVerifier()insteadVerifies that the provided file will raise all the expected issues when analyzed with the given check and a given java version used for the sources.- Parameters:
filename- The file to be analyzedcheck- The check to be used for the analysisjavaVersion- The version to consider for the analysis (6 for java 1.6, 7 for 1.7, etc.)
-
verify
@Deprecated public static void verify(String filename, JavaFileScanner check, Collection<File> classpath)
Deprecated.usenewVerifier()insteadVerifies that the provided file will raise all the expected issues when analyzed with the given check, but using having the classpath extended with a collection of files (classes/jar/zip).- Parameters:
filename- The file to be analyzedcheck- The check to be used for the analysisclasspath- The files to be used as classpath
-
verify
@Deprecated public static void verify(String filename, JavaFileScanner check, String testJarsDirectory)
Deprecated.usenewVerifier()insteadVerifies that the provided file will raise all the expected issues when analyzed with the given check, using jars/zips files from the given directory to extends the classpath.- Parameters:
filename- The file to be analyzedcheck- The check to be used for the analysistestJarsDirectory- The directory containing jars and/or zip defining the classpath to be used
-
verifyNoIssue
@Deprecated public static void verifyNoIssue(String filename, JavaFileScanner check)
Deprecated.usenewVerifier()insteadVerifies that the provided file will not raise any issue when analyzed with the given check.- Parameters:
filename- The file to be analyzedcheck- The check to be used for the analysis
-
verifyNoIssueWithoutSemantic
@Deprecated public static void verifyNoIssueWithoutSemantic(String filename, JavaFileScanner check, int javaVersion)
Deprecated.usenewVerifier()instead
-
verifyNoIssueWithoutSemantic
@Deprecated public static void verifyNoIssueWithoutSemantic(String filename, JavaFileScanner check)
Deprecated.usenewVerifier()instead
-
verifyNoIssue
@Deprecated public static void verifyNoIssue(String filename, JavaFileScanner check, int javaVersion)
Deprecated.usenewVerifier()insteadVerifies that the provided file will not raise any issue when analyzed with the given check.- Parameters:
filename- The file to be analyzedcheck- The check to be used for the analysisjavaVersion- The version to consider for the analysis (6 for java 1.6, 7 for 1.7, etc.)
-
verifyIssueOnFile
@Deprecated public static void verifyIssueOnFile(String filename, String message, JavaFileScanner check)
Deprecated.usenewVerifier()insteadVerifies that the provided file will only raise an issue on the file, with the given message, when analyzed using the given check.- Parameters:
filename- The file to be analyzedmessage- The message expected to be raised on the filecheck- The check to be used for the analysis
-
verifyIssueOnProject
@Deprecated public static void verifyIssueOnProject(String filename, String message, JavaFileScanner check)
Deprecated.usenewVerifier()instead
-
-