Package org.sonar.java
Class SonarComponents
java.lang.Object
org.sonar.java.SonarComponents
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSonarComponents(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory, org.sonar.api.batch.fs.FileSystem fs, ClasspathForMain javaClasspath, ClasspathForTest javaTestClasspath, org.sonar.api.batch.rule.CheckFactory checkFactory) SonarComponents(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory, org.sonar.api.batch.fs.FileSystem fs, ClasspathForMain javaClasspath, ClasspathForTest javaTestClasspath, org.sonar.api.batch.rule.CheckFactory checkFactory, org.sonar.api.batch.bootstrap.ProjectDefinition projectDefinition) Will be called in SonarScanner context when no custom rules is presentSonarComponents(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory, org.sonar.api.batch.fs.FileSystem fs, ClasspathForMain javaClasspath, ClasspathForTest javaTestClasspath, org.sonar.api.batch.rule.CheckFactory checkFactory, CheckRegistrar[] checkRegistrars) Will be called in SonarLint context when custom rules are presentSonarComponents(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory, org.sonar.api.batch.fs.FileSystem fs, ClasspathForMain javaClasspath, ClasspathForTest javaTestClasspath, org.sonar.api.batch.rule.CheckFactory checkFactory, CheckRegistrar[] checkRegistrars, org.sonar.api.batch.bootstrap.ProjectDefinition projectDefinition) ProjectDefinition class is not available in SonarLint context, so this constructor will never be called when using SonarLint -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIssue(org.sonar.api.batch.fs.InputComponent inputComponent, JavaCheck check, int line, String message, Integer cost) booleanbooleanvoidcollectUndefinedTypes(Set<JProblem> undefinedTypes) org.sonar.api.batch.sensor.SensorContextcontext()booleanfileCanBeSkipped(org.sonar.api.batch.fs.InputFile inputFile) fileLines(org.sonar.api.batch.fs.InputFile inputFile) org.sonar.api.measures.FileLinesContextfileLinesContextFor(org.sonar.api.batch.fs.InputFile inputFile) longReturns the batch mode size as read from configuration, in Kilo Bytes.Returns an OS-independent key that should identify the module within the projectOptional<org.sonar.api.rule.RuleKey>getRuleKey(JavaCheck check) org.sonar.api.batch.sensor.highlighting.NewHighlightinghighlightableFor(org.sonar.api.batch.fs.InputFile inputFile) booleaninputFileContents(org.sonar.api.batch.fs.InputFile inputFile) booleanbooleanbooleanbooleanbooleanbooleanvoidorg.sonar.api.batch.fs.InputComponentproject()voidregisterMainCheckClasses(String repositoryKey, Iterable<Class<? extends JavaCheck>> checkClasses) voidregisterTestCheckClasses(String repositoryKey, Iterable<Class<? extends JavaCheck>> checkClasses) booleanreportAnalysisError(com.sonar.sslr.api.RecognitionException re, org.sonar.api.batch.fs.InputFile inputFile) voidreportIssue(AnalyzerMessage analyzerMessage) voidsetCheckFilter(UnaryOperator<List<JavaCheck>> checkFilter) voidsetSensorContext(org.sonar.api.batch.sensor.SensorContext context) booleanorg.sonar.api.batch.sensor.symbol.NewSymbolTablesymbolizableFor(org.sonar.api.batch.fs.InputFile inputFile)
-
Field Details
-
FAIL_ON_EXCEPTION_KEY
- See Also:
-
SONAR_BATCH_MODE_KEY
- See Also:
-
SONAR_AUTOSCAN
- See Also:
-
SONAR_AUTOSCAN_CHECK_FILTERING
- See Also:
-
SONAR_BATCH_SIZE_KEY
- See Also:
-
SONAR_FILE_BY_FILE
- See Also:
-
SONAR_CAN_SKIP_UNCHANGED_FILES_KEY
Describes if an optimized analysis of unchanged by skipping some rules is enabled. By default, the property is not set (null), leaving SQ/SC to decide whether to enable this behavior. Setting it to true or false, forces the behavior from the analyzer independently of the server.- See Also:
-
-
Constructor Details
-
SonarComponents
public SonarComponents(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory, org.sonar.api.batch.fs.FileSystem fs, ClasspathForMain javaClasspath, ClasspathForTest javaTestClasspath, org.sonar.api.batch.rule.CheckFactory checkFactory) -
SonarComponents
public SonarComponents(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory, org.sonar.api.batch.fs.FileSystem fs, ClasspathForMain javaClasspath, ClasspathForTest javaTestClasspath, org.sonar.api.batch.rule.CheckFactory checkFactory, @Nullable CheckRegistrar[] checkRegistrars) Will be called in SonarLint context when custom rules are present -
SonarComponents
public SonarComponents(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory, org.sonar.api.batch.fs.FileSystem fs, ClasspathForMain javaClasspath, ClasspathForTest javaTestClasspath, org.sonar.api.batch.rule.CheckFactory checkFactory, @Nullable org.sonar.api.batch.bootstrap.ProjectDefinition projectDefinition) Will be called in SonarScanner context when no custom rules is present -
SonarComponents
public SonarComponents(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory, org.sonar.api.batch.fs.FileSystem fs, ClasspathForMain javaClasspath, ClasspathForTest javaTestClasspath, org.sonar.api.batch.rule.CheckFactory checkFactory, @Nullable CheckRegistrar[] checkRegistrars, @Nullable org.sonar.api.batch.bootstrap.ProjectDefinition projectDefinition) ProjectDefinition class is not available in SonarLint context, so this constructor will never be called when using SonarLint
-
-
Method Details
-
setSensorContext
public void setSensorContext(org.sonar.api.batch.sensor.SensorContext context) -
setCheckFilter
-
fileLinesContextFor
public org.sonar.api.measures.FileLinesContext fileLinesContextFor(org.sonar.api.batch.fs.InputFile inputFile) -
symbolizableFor
public org.sonar.api.batch.sensor.symbol.NewSymbolTable symbolizableFor(org.sonar.api.batch.fs.InputFile inputFile) -
highlightableFor
public org.sonar.api.batch.sensor.highlighting.NewHighlighting highlightableFor(org.sonar.api.batch.fs.InputFile inputFile) -
getJavaClasspath
-
inAndroidContext
public boolean inAndroidContext() -
getJavaTestClasspath
-
getJspClasspath
-
registerMainCheckClasses
-
registerTestCheckClasses
-
mainChecks
-
testChecks
-
jspChecks
-
getRuleKey
-
addIssue
-
reportIssue
-
reportAnalysisError
public boolean reportAnalysisError(com.sonar.sslr.api.RecognitionException re, org.sonar.api.batch.fs.InputFile inputFile) -
isSonarLintContext
public boolean isSonarLintContext() -
isQuickFixCompatible
public boolean isQuickFixCompatible() -
isSetQuickFixAvailableCompatible
public boolean isSetQuickFixAvailableCompatible() -
fileLines
-
inputFileContents
-
analysisCancelled
public boolean analysisCancelled() -
shouldFailAnalysisOnException
public boolean shouldFailAnalysisOnException() -
isFileByFileEnabled
public boolean isFileByFileEnabled() -
isAutoScan
public boolean isAutoScan() -
isAutoScanCheckFiltering
public boolean isAutoScanCheckFiltering() -
getBatchModeSizeInKB
public long getBatchModeSizeInKB()Returns the batch mode size as read from configuration, in Kilo Bytes. If not value can be found, compute dynamically an ideal value.- Returns:
- the batch mode size or a default value of -1L.
-
projectLevelWorkDir
-
getModuleKey
Returns an OS-independent key that should identify the module within the project- Returns:
- A key representing the module
-
canSkipUnchangedFiles
- Throws:
ApiMismatchException
-
fileCanBeSkipped
public boolean fileCanBeSkipped(org.sonar.api.batch.fs.InputFile inputFile) -
project
public org.sonar.api.batch.fs.InputComponent project() -
collectUndefinedTypes
-
logUndefinedTypes
public void logUndefinedTypes() -
context
public org.sonar.api.batch.sensor.SensorContext context()
-