use of org.sonarsource.sonarlint.core.commons.progress.ClientProgressMonitor in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method updateProject.
@Override
public void updateProject(EndpointParams endpoint, HttpClient client, String projectKey, boolean fetchTaintVulnerabilities, @Nullable String branchName, @Nullable ClientProgressMonitor monitor) {
requireNonNull(endpoint);
requireNonNull(projectKey);
setLogging(null);
var globalStorageStatus = globalStatusReader.read();
if (globalStorageStatus == null || globalStorageStatus.isStale()) {
throw new StorageException("Missing or outdated storage for connection '" + globalConfig.getConnectionId() + "'");
}
projectStorageUpdateExecutor.update(new ServerApiHelper(endpoint, client), projectKey, fetchTaintVulnerabilities, branchName, new ProgressMonitor(monitor));
}
use of org.sonarsource.sonarlint.core.commons.progress.ClientProgressMonitor 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);
}
}
use of org.sonarsource.sonarlint.core.commons.progress.ClientProgressMonitor in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method analyze.
@Override
public AnalysisResults analyze(ConnectedAnalysisConfiguration configuration, IssueListener issueListener, @Nullable ClientLogOutput logOutput, @Nullable ClientProgressMonitor monitor) {
requireNonNull(configuration);
requireNonNull(issueListener);
setLogging(logOutput);
checkStatus(configuration.projectKey());
var analysisConfigBuilder = AnalysisConfiguration.builder().addInputFiles(configuration.inputFiles());
var projectKey = configuration.projectKey();
if (projectKey != null) {
analysisConfigBuilder.putAllExtraProperties(projectStorage.getAnalyzerConfiguration(projectKey).getSettings().getAll());
analysisConfigBuilder.putAllExtraProperties(globalConfig.extraProperties());
}
var activeRulesContext = buildActiveRulesContext(configuration);
analysisConfigBuilder.putAllExtraProperties(configuration.extraProperties()).addActiveRules(activeRulesContext.activeRules).setBaseDir(configuration.baseDir()).build();
var analysisConfiguration = analysisConfigBuilder.build();
try {
var analysisResults = getAnalysisEngine().post(new AnalyzeCommand(configuration.moduleKey(), analysisConfiguration, issue -> streamIssue(issueListener, issue, activeRulesContext), logOutput), new ProgressMonitor(monitor)).get();
return analysisResults == null ? new AnalysisResults() : analysisResults;
} catch (Exception e) {
throw SonarLintWrappedException.wrap(e);
}
}
use of org.sonarsource.sonarlint.core.commons.progress.ClientProgressMonitor in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method sync.
@Override
public void sync(EndpointParams endpoint, HttpClient client, Set<String> projectKeys, @Nullable ClientProgressMonitor monitor) {
var serverApi = new ServerApi(new ServerApiHelper(endpoint, client));
var result = storageSynchronizer.synchronize(serverApi, projectKeys, new ProgressMonitor(monitor));
if (result.hasAnalyzerBeenUpdated()) {
restartAnalysisEngine();
}
}
use of org.sonarsource.sonarlint.core.commons.progress.ClientProgressMonitor in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method update.
@Override
public UpdateResult update(EndpointParams endpoint, HttpClient client, @Nullable ClientProgressMonitor monitor) {
requireNonNull(endpoint);
setLogging(null);
globalStorageUpdateExecutor.update(new ServerApiHelper(endpoint, client), new ProgressMonitor(monitor));
return new UpdateResult(globalStatusReader.read());
}
Aggregations