use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method analyze.
@Override
public AnalysisResults analyze(ConnectedAnalysisConfiguration configuration, IssueListener issueListener, @Nullable LogOutput logOutput, @Nullable ProgressMonitor monitor) {
checkNotNull(configuration);
checkNotNull(issueListener);
setLogging(logOutput);
LoggedErrorHandler errorHandler = new LoggedErrorHandler(configuration.inputFiles());
SonarLintLogging.setErrorHandler(errorHandler);
return withReadLock(() -> {
try {
AnalysisResults results = getHandler().analyze(storageContainer.getGlobalExtensionContainer(), configuration, issueListener, new ProgressWrapper(monitor));
errorHandler.getErrorFiles().forEach(results.failedAnalysisFiles()::add);
return results;
} catch (RuntimeException e) {
throw SonarLintWrappedException.wrap(e);
}
});
}
use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.
the class StandaloneSonarLintEngineImpl method analyze.
@Override
public AnalysisResults analyze(StandaloneAnalysisConfiguration configuration, IssueListener issueListener, @Nullable LogOutput logOutput, @Nullable ProgressMonitor monitor) {
checkNotNull(configuration);
checkNotNull(issueListener);
setLogging(logOutput);
LoggedErrorHandler errorHandler = new LoggedErrorHandler(configuration.inputFiles());
SonarLintLogging.setErrorHandler(errorHandler);
rwl.readLock().lock();
try {
AnalysisResults results = globalContainer.analyze(configuration, issueListener, new ProgressWrapper(monitor));
errorHandler.getErrorFiles().forEach(results.failedAnalysisFiles()::add);
return results;
} catch (RuntimeException e) {
throw SonarLintWrappedException.wrap(e);
} finally {
rwl.readLock().unlock();
}
}
use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.
the class WsHelperImpl method validateConnection.
static ValidationResult validateConnection(SonarLintWsClient client, @Nullable String organizationKey) {
ServerVersionAndStatusChecker serverChecker = new ServerVersionAndStatusChecker(client);
AuthenticationChecker authChecker = new AuthenticationChecker(client);
try {
ServerInfos serverStatus = serverChecker.checkVersionAndStatus();
ValidationResult validateCredentials = authChecker.validateCredentials();
if (validateCredentials.success() && organizationKey != null) {
Version serverVersion = Version.create(serverStatus.getVersion());
if (serverVersion.compareToIgnoreQualifier(Version.create(MIN_VERSION_FOR_ORGANIZATIONS)) < 0) {
return new DefaultValidationResult(false, "No organization support for this server version: " + serverStatus.getVersion());
}
if (fetchOrganizations(client, organizationKey, new ProgressWrapper(null)).isEmpty()) {
return new DefaultValidationResult(false, "No organizations found for key: " + organizationKey);
}
}
return validateCredentials;
} catch (UnsupportedServerException e) {
return new DefaultValidationResult(false, e.getMessage());
} catch (RuntimeException e) {
throw SonarLintWrappedException.wrap(e);
}
}
Aggregations