Skip to content

Commit

Permalink
Use latest SLCORE
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent f047f51 commit 116d30f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<properties>
<jdk.min.version>11</jdk.min.version>
<sonarlint.core.version>9.0.0.74108</sonarlint.core.version>
<sonarlint.core.version>9.0.0.74282</sonarlint.core.version>
<!-- Version used by Xodus -->
<kotlin.version>1.6.10</kotlin.version>
<!-- analyzers used for tests -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.stream.Collectors;
import org.eclipse.lsp4j.WorkspaceFolder;
import org.sonarsource.sonarlint.core.clientapi.SonarLintBackend;
import org.sonarsource.sonarlint.core.clientapi.backend.InitializeParams;
import org.sonarsource.sonarlint.core.clientapi.backend.analysis.GetSupportedFilePatternsParams;
import org.sonarsource.sonarlint.core.clientapi.backend.analysis.GetSupportedFilePatternsResponse;
import org.sonarsource.sonarlint.core.clientapi.backend.binding.GetBindingSuggestionParams;
Expand All @@ -51,6 +50,7 @@
import org.sonarsource.sonarlint.core.clientapi.backend.hotspot.CheckStatusChangePermittedParams;
import org.sonarsource.sonarlint.core.clientapi.backend.hotspot.CheckStatusChangePermittedResponse;
import org.sonarsource.sonarlint.core.clientapi.backend.hotspot.OpenHotspotInBrowserParams;
import org.sonarsource.sonarlint.core.clientapi.backend.initialize.InitializeParams;
import org.sonarsource.sonarlint.core.clientapi.backend.issue.AddIssueCommentParams;
import org.sonarsource.sonarlint.core.clientapi.backend.issue.ChangeIssueStatusParams;
import org.sonarsource.sonarlint.core.clientapi.backend.rules.GetEffectiveRuleDetailsParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import javax.annotation.Nullable;
import org.eclipse.lsp4j.WorkspaceFolder;
import org.sonarsource.sonarlint.core.clientapi.SonarLintBackend;
import org.sonarsource.sonarlint.core.clientapi.backend.HostInfoDto;
import org.sonarsource.sonarlint.core.clientapi.backend.InitializeParams;
import org.sonarsource.sonarlint.core.clientapi.backend.config.binding.BindingConfigurationDto;
import org.sonarsource.sonarlint.core.clientapi.backend.config.scope.ConfigurationScopeDto;
import org.sonarsource.sonarlint.core.clientapi.backend.config.scope.DidAddConfigurationScopesParams;
Expand All @@ -40,6 +38,9 @@
import org.sonarsource.sonarlint.core.clientapi.backend.connection.validate.ValidateConnectionResponse;
import org.sonarsource.sonarlint.core.clientapi.backend.hotspot.CheckLocalDetectionSupportedParams;
import org.sonarsource.sonarlint.core.clientapi.backend.hotspot.CheckLocalDetectionSupportedResponse;
import org.sonarsource.sonarlint.core.clientapi.backend.initialize.ClientInfoDto;
import org.sonarsource.sonarlint.core.clientapi.backend.initialize.FeatureFlagsDto;
import org.sonarsource.sonarlint.core.clientapi.backend.initialize.InitializeParams;
import org.sonarsource.sonarlint.core.clientapi.backend.rules.GetEffectiveRuleDetailsParams;
import org.sonarsource.sonarlint.core.clientapi.backend.rules.GetEffectiveRuleDetailsResponse;
import org.sonarsource.sonarlint.core.clientapi.backend.rules.GetStandaloneRuleDescriptionParams;
Expand Down Expand Up @@ -106,24 +107,18 @@ private void initOnce(Map<String, ServerConnectionSettings> connections) {

private static InitializeParams toInitParams(BackendInitParams initParams) {
return new InitializeParams(
new HostInfoDto("Visual Studio Code"),
initParams.getTelemetryProductKey(),
new ClientInfoDto("Visual Studio Code", initParams.getTelemetryProductKey(), initParams.getUserAgent()),
new FeatureFlagsDto(true, true, true, true, initParams.isEnableSecurityHotspots()),
initParams.getStorageRoot(),
null,
initParams.getEmbeddedPluginPaths(),
initParams.getConnectedModeEmbeddedPluginPathsByKey(),
initParams.getEnabledLanguagesInStandaloneMode(),
initParams.getExtraEnabledLanguagesInConnectedMode(),
initParams.isEnableSecurityHotspots(),
initParams.getSonarQubeConnections(),
initParams.getSonarCloudConnections(),
initParams.getSonarlintUserHome(),
true,
initParams.getStandaloneRuleConfigByKey(),
true,
true,
true,
initParams.getUserAgent()
initParams.getStandaloneRuleConfigByKey()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.sonarsource.sonarlint.core.clientapi.client.fs.FindFileByNamesInScopeResponse;
import org.sonarsource.sonarlint.core.clientapi.client.http.CheckServerTrustedParams;
import org.sonarsource.sonarlint.core.clientapi.client.http.CheckServerTrustedResponse;
import org.sonarsource.sonarlint.core.clientapi.client.info.GetClientInfoResponse;
import org.sonarsource.sonarlint.core.clientapi.client.progress.ReportProgressParams;
import org.sonarsource.sonarlint.core.clientapi.client.progress.StartProgressParams;
import org.sonarsource.sonarlint.core.clientapi.client.smartnotification.ShowSmartNotificationParams;
Expand Down Expand Up @@ -94,7 +95,7 @@ public void showSmartNotification(ShowSmartNotificationParams showSmartNotificat
}

@Override
public CompletableFuture<org.sonarsource.sonarlint.core.clientapi.client.host.GetHostInfoResponse> getHostInfo() {
public CompletableFuture<GetClientInfoResponse> getClientInfo() {
return CompletableFuture.completedFuture(server.getHostInfo());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.eclipse.lsp4j.MessageType;
import org.eclipse.lsp4j.ShowMessageRequestParams;
import org.sonarsource.sonarlint.core.clientapi.client.binding.AssistBindingParams;
import org.sonarsource.sonarlint.core.clientapi.client.host.GetHostInfoResponse;
import org.sonarsource.sonarlint.core.clientapi.client.info.GetClientInfoResponse;
import org.sonarsource.sonarlint.ls.SonarLintExtendedLanguageClient;

public class RequestsHandlerServer {
Expand All @@ -42,8 +42,8 @@ public void initialize(String clientVersion, @Nullable String workspaceName) {
this.workspaceName = workspaceName == null ? "(no open folder)" : workspaceName;
}

public GetHostInfoResponse getHostInfo() {
return new GetHostInfoResponse(this.clientVersion + " - " + this.workspaceName);
public GetClientInfoResponse getHostInfo() {
return new GetClientInfoResponse(this.clientVersion + " - " + this.workspaceName);
}

public void showHotspotHandleUnknownServer(String url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
import org.sonarsource.sonarlint.core.clientapi.client.binding.SuggestBindingParams;
import org.sonarsource.sonarlint.core.clientapi.client.connection.AssistCreatingConnectionParams;
import org.sonarsource.sonarlint.core.clientapi.client.fs.FindFileByNamesInScopeParams;
import org.sonarsource.sonarlint.core.clientapi.client.host.GetHostInfoResponse;
import org.sonarsource.sonarlint.core.clientapi.client.hotspot.HotspotDetailsDto;
import org.sonarsource.sonarlint.core.clientapi.client.hotspot.ShowHotspotParams;
import org.sonarsource.sonarlint.core.clientapi.client.http.CheckServerTrustedParams;
import org.sonarsource.sonarlint.core.clientapi.client.http.X509CertificateDto;
import org.sonarsource.sonarlint.core.clientapi.client.info.GetClientInfoResponse;
import org.sonarsource.sonarlint.core.clientapi.client.message.ShowMessageParams;
import org.sonarsource.sonarlint.core.clientapi.client.progress.StartProgressParams;
import org.sonarsource.sonarlint.core.clientapi.client.smartnotification.ShowSmartNotificationParams;
Expand Down Expand Up @@ -153,7 +153,6 @@ void shouldThrowForShowMessage() {
@Test
void shouldHandleShowSmartNotificationWhenConnectionExists() {
var workspaceSettings = mock(WorkspaceSettings.class);
var backendServiceFacade = mock(BackendServiceFacade.class);
var showSmartNotificationParams = mock(ShowSmartNotificationParams.class);
when(showSmartNotificationParams.getConnectionId()).thenReturn("testId");
var serverConnections = Map.of("testId",
Expand All @@ -173,7 +172,6 @@ void shouldHandleShowSmartNotificationWhenConnectionExists() {
@Test
void shouldHandleShowSmartNotificationWhenConnectionExistsForSonarCloud() {
var workspaceSettings = mock(WorkspaceSettings.class);
var backendServiceFacade = mock(BackendServiceFacade.class);
var showSmartNotificationParams = mock(ShowSmartNotificationParams.class);
when(showSmartNotificationParams.getConnectionId()).thenReturn("testId");
var serverConnections = Map.of("testId",
Expand Down Expand Up @@ -234,15 +232,15 @@ void shouldAskTheClientToFindFiles() {

@Test
void shouldCallServerOnGetHostInfo() {
underTest.getHostInfo();
underTest.getClientInfo();
verify(server).getHostInfo();
}

@Test
void shouldGetHostInfo() throws ExecutionException, InterruptedException {
var desc = "This is Test";
when(server.getHostInfo()).thenReturn(new GetHostInfoResponse("This is Test"));
var result = underTest.getHostInfo().get();
when(server.getHostInfo()).thenReturn(new GetClientInfoResponse("This is Test"));
var result = underTest.getClientInfo().get();
assertThat(result.getDescription()).isEqualTo(desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ void test_analysis_with_debug_logs_enabled() throws Exception {
.contains(
"[Info] Analyzing file '" + uri + "'...",
"[Info] Index files",
"[Debug] Language of file '" + uri + "' is set to 'Python'",
"[Debug] Language of file \"" + uri + "\" is set to \"Python\"",
"[Info] 1 file indexed",
"[Debug] Execute Sensor: Python Sensor",
"[Info] Found 1 issue"));
Expand Down

0 comments on commit 116d30f

Please sign in to comment.