Class SonarComponents


  • @ScannerSide
    @SonarLintSide
    public class SonarComponents
    extends Object
    • Constructor Detail

      • SonarComponents

        public SonarComponents​(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory,
                               org.sonar.api.batch.fs.FileSystem fs,
                               JavaClasspath javaClasspath,
                               JavaTestClasspath javaTestClasspath,
                               org.sonar.api.batch.rule.CheckFactory checkFactory)
      • SonarComponents

        public SonarComponents​(org.sonar.api.measures.FileLinesContextFactory fileLinesContextFactory,
                               org.sonar.api.batch.fs.FileSystem fs,
                               JavaClasspath javaClasspath,
                               JavaTestClasspath 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,
                               JavaClasspath javaClasspath,
                               JavaTestClasspath 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,
                               JavaClasspath javaClasspath,
                               JavaTestClasspath 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 Detail

      • setSensorContext

        public void setSensorContext​(org.sonar.api.batch.sensor.SensorContext context)
      • inputFromIOFile

        public org.sonar.api.batch.fs.InputFile inputFromIOFile​(File file)
      • fileLength

        public int fileLength​(File file)
      • fileLinesContextFor

        public org.sonar.api.measures.FileLinesContext fileLinesContextFor​(File file)
      • symbolizableFor

        public org.sonar.api.batch.sensor.symbol.NewSymbolTable symbolizableFor​(File file)
      • highlightableFor

        public org.sonar.api.batch.sensor.highlighting.NewHighlighting highlightableFor​(File file)
      • getJavaClasspath

        public List<File> getJavaClasspath()
      • getJavaTestClasspath

        public List<File> getJavaTestClasspath()
      • checkClasses

        public JavaCheck[] checkClasses()
      • registerTestCheckClasses

        public void registerTestCheckClasses​(String repositoryKey,
                                             Iterable<Class<? extends JavaCheck>> checkClasses)
      • getFileSystem

        public org.sonar.api.batch.fs.FileSystem getFileSystem()
      • getRuleKey

        public org.sonar.api.rule.RuleKey getRuleKey​(JavaCheck check)
      • reportIssue

        public void reportIssue​(AnalyzerMessage analyzerMessage)
      • reportAnalysisError

        public boolean reportAnalysisError​(com.sonar.sslr.api.RecognitionException re,
                                           File file)
      • reportAnalysisError

        public void reportAnalysisError​(File file,
                                        String message)
      • isSonarLintContext

        public boolean isSonarLintContext()
      • fileContent

        public String fileContent​(File file)
      • analysisCancelled

        public boolean analysisCancelled()
      • addAnalysisError

        public void addAnalysisError​(AnalysisError analysisError)
      • saveAnalysisErrors

        public void saveAnalysisErrors()
      • shouldFailAnalysisOnException

        public boolean shouldFailAnalysisOnException()
      • workDir

        public File workDir()