Search in sources :

Example 1 with SonarLintInputFile

use of org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintInputFile in project sonarlint-core by SonarSource.

the class DefaultSensorStorage method store.

@Override
public void store(AnalysisError analysisError) {
    ClientInputFile clientInputFile = ((SonarLintInputFile) analysisError.inputFile()).getClientInputFile();
    analysisResult.addFailedAnalysisFile(clientInputFile);
}
Also used : SonarLintInputFile(org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintInputFile) ClientInputFile(org.sonarsource.sonarlint.core.client.api.common.analysis.ClientInputFile)

Example 2 with SonarLintInputFile

use of org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintInputFile in project sonarlint-core by SonarSource.

the class DefaultSensorStorage method store.

@Override
public void store(Issue issue) {
    InputComponent inputComponent = issue.primaryLocation().inputComponent();
    DefaultRule rule = validateRule(issue);
    ActiveRule activeRule = activeRules.find(issue.ruleKey());
    if (activeRule == null) {
        // rule does not exist or is not enabled -> ignore the issue
        return;
    }
    String primaryMessage = Strings.isNullOrEmpty(issue.primaryLocation().message()) ? rule.name() : issue.primaryLocation().message();
    org.sonar.api.batch.rule.Severity overriddenSeverity = issue.overriddenSeverity();
    String severity = overriddenSeverity != null ? overriddenSeverity.name() : activeRule.severity();
    String type = rule.type();
    DefaultClientIssue newIssue = new DefaultClientIssue(severity, type, activeRule, rules.find(activeRule.ruleKey()), primaryMessage, issue.primaryLocation().textRange(), inputComponent.isFile() ? ((SonarLintInputFile) inputComponent).getClientInputFile() : null, issue.flows());
    if (filters.accept(inputComponent, newIssue)) {
        issueListener.handle(newIssue);
    }
}
Also used : DefaultRule(org.sonar.api.batch.rule.internal.DefaultRule) SonarLintInputFile(org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintInputFile) InputComponent(org.sonar.api.batch.fs.InputComponent) ActiveRule(org.sonar.api.batch.rule.ActiveRule) DefaultClientIssue(org.sonarsource.sonarlint.core.analyzer.issue.DefaultClientIssue)

Aggregations

SonarLintInputFile (org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintInputFile)2 InputComponent (org.sonar.api.batch.fs.InputComponent)1 ActiveRule (org.sonar.api.batch.rule.ActiveRule)1 DefaultRule (org.sonar.api.batch.rule.internal.DefaultRule)1 DefaultClientIssue (org.sonarsource.sonarlint.core.analyzer.issue.DefaultClientIssue)1 ClientInputFile (org.sonarsource.sonarlint.core.client.api.common.analysis.ClientInputFile)1