Search in sources :

Example 21 with JavaCheck

use of org.sonar.plugins.java.api.JavaCheck in project sonar-java by SonarSource.

the class SonarComponents method reportIssue.

public void reportIssue(AnalyzerMessage analyzerMessage) {
    JavaCheck check = analyzerMessage.getCheck();
    Preconditions.checkNotNull(check);
    Preconditions.checkNotNull(analyzerMessage.getMessage());
    RuleKey key = getRuleKey(check);
    if (key == null) {
        return;
    }
    File file = analyzerMessage.getFile();
    InputPath inputPath = inputPathFromIOFile(file);
    if (inputPath == null) {
        return;
    }
    Double cost = analyzerMessage.getCost();
    reportIssue(analyzerMessage, key, inputPath, cost);
}
Also used : InputPath(org.sonar.api.batch.fs.InputPath) RuleKey(org.sonar.api.rule.RuleKey) JavaCheck(org.sonar.plugins.java.api.JavaCheck) InputFile(org.sonar.api.batch.fs.InputFile) File(java.io.File)

Aggregations

JavaCheck (org.sonar.plugins.java.api.JavaCheck)21 File (java.io.File)16 Test (org.junit.Test)14 InputFile (org.sonar.api.batch.fs.InputFile)8 DefaultInputFile (org.sonar.api.batch.fs.internal.DefaultInputFile)7 CheckRegistrar (org.sonar.plugins.java.api.CheckRegistrar)7 DefaultFileSystem (org.sonar.api.batch.fs.internal.DefaultFileSystem)6 RuleKey (org.sonar.api.rule.RuleKey)6 TestInputFileBuilder (org.sonar.api.batch.fs.internal.TestInputFileBuilder)5 SensorContextTester (org.sonar.api.batch.sensor.internal.SensorContextTester)4 ImmutableList (com.google.common.collect.ImmutableList)2 RecognitionException (com.sonar.sslr.api.RecognitionException)2 LexerException (com.sonar.sslr.impl.LexerException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 NewHighlighting (org.sonar.api.batch.sensor.highlighting.NewHighlighting)2 NewSymbolTable (org.sonar.api.batch.sensor.symbol.NewSymbolTable)2 Issuable (org.sonar.api.issue.Issuable)2 Issue (org.sonar.api.issue.Issue)2 FileLinesContext (org.sonar.api.measures.FileLinesContext)2