use of org.sonarsource.sonarlint.core.client.api.common.analysis.DefaultClientIssue in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method streamIssue.
private static void streamIssue(IssueListener issueListener, Issue newIssue, ActiveRulesContext activeRulesContext) {
var ruleMetadata = activeRulesContext.getRuleMetadata(newIssue.getRuleKey());
issueListener.handle(new DefaultClientIssue(newIssue, ruleMetadata.severity, ruleMetadata.type));
}
use of org.sonarsource.sonarlint.core.client.api.common.analysis.DefaultClientIssue in project sonarlint-core by SonarSource.
the class StandaloneSonarLintEngineImpl method analyze.
@Override
public AnalysisResults analyze(StandaloneAnalysisConfiguration configuration, IssueListener issueListener, @Nullable ClientLogOutput logOutput, @Nullable ClientProgressMonitor monitor) {
requireNonNull(configuration);
requireNonNull(issueListener);
setLogging(logOutput);
var analysisConfig = AnalysisConfiguration.builder().addInputFiles(configuration.inputFiles()).putAllExtraProperties(configuration.extraProperties()).addActiveRules(identifyActiveRules(configuration)).setBaseDir(configuration.baseDir()).build();
try {
var analysisResults = analysisEngine.post(new AnalyzeCommand(configuration.moduleKey(), analysisConfig, i -> issueListener.handle(new DefaultClientIssue(i, allRulesDefinitionsByKey.get(i.getRuleKey()))), logOutput), new ProgressMonitor(monitor)).get();
return analysisResults == null ? new AnalysisResults() : analysisResults;
} catch (Exception e) {
throw SonarLintWrappedException.wrap(e);
}
}
Aggregations