Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLLS-286 Fix cycle between classes #419

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

import static java.lang.String.format;
import static java.util.function.Function.identity;
import static org.sonarsource.sonarlint.ls.backend.BackendServiceFacade.ROOT_CONFIGURATION_SCOPE;
import static org.sonarsource.sonarlint.ls.backend.BackendService.ROOT_CONFIGURATION_SCOPE;

public class AnalysisHelper {
private final SonarLintExtendedLanguageClient client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
import static org.sonarsource.sonarlint.ls.CommandManager.SONARLINT_SHOW_SECURITY_HOTSPOT_FLOWS;
import static org.sonarsource.sonarlint.ls.SonarLintExtendedLanguageClient.ConnectionCheckResult.failure;
import static org.sonarsource.sonarlint.ls.SonarLintExtendedLanguageClient.ConnectionCheckResult.success;
import static org.sonarsource.sonarlint.ls.backend.BackendServiceFacade.ROOT_CONFIGURATION_SCOPE;
import static org.sonarsource.sonarlint.ls.backend.BackendService.ROOT_CONFIGURATION_SCOPE;
import static org.sonarsource.sonarlint.ls.util.URIUtils.getFullFileUriFromFragments;
import static org.sonarsource.sonarlint.ls.util.Utils.getConnectionNameFromConnectionCheckParams;
import static org.sonarsource.sonarlint.ls.util.Utils.getValidateConnectionParamsForNewConnection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@
import org.sonarsource.sonarlint.ls.settings.ServerConnectionSettings;
import org.sonarsource.sonarlint.ls.util.EnumLabelsMapper;

import static org.sonarsource.sonarlint.ls.backend.BackendServiceFacade.ROOT_CONFIGURATION_SCOPE;

public class BackendService {

public static final String ROOT_CONFIGURATION_SCOPE = "<root>";

private final SonarLintRpcServer backend;
private final LanguageClientLogger logOutput;
private final SonarLintExtendedLanguageClient client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public class BackendServiceFacade {

private static final int DEFAULT_INIT_TIMEOUT_SECONDS = 60;

public static final String ROOT_CONFIGURATION_SCOPE = "<root>";

private final int initTimeoutSeconds;
private final BackendService backendService;
private final BackendInitParams initParams;
Expand Down Expand Up @@ -101,7 +99,7 @@ public BackendServiceFacade(SonarLintRpcClientDelegate rpcClient, LanguageClient
}

this.initParams = new BackendInitParams();
this.rootConfigurationScope = new ConfigurationScopeDto(ROOT_CONFIGURATION_SCOPE, null, false, ROOT_CONFIGURATION_SCOPE,
this.rootConfigurationScope = new ConfigurationScopeDto(BackendService.ROOT_CONFIGURATION_SCOPE, null, false, BackendService.ROOT_CONFIGURATION_SCOPE,
new BindingConfigurationDto(null, null, false)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
import static java.lang.String.format;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toList;
import static org.sonarsource.sonarlint.ls.backend.BackendServiceFacade.ROOT_CONFIGURATION_SCOPE;
import static org.sonarsource.sonarlint.ls.backend.BackendService.ROOT_CONFIGURATION_SCOPE;
import static org.sonarsource.sonarlint.ls.util.URIUtils.getFullFileUriFromFragments;
import static org.sonarsource.sonarlint.ls.util.Utils.convertMessageType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.sonarsource.sonarlint.ls.settings.WorkspaceFolderSettings;
import org.sonarsource.sonarlint.ls.util.Utils;

import static org.sonarsource.sonarlint.ls.backend.BackendServiceFacade.ROOT_CONFIGURATION_SCOPE;
import static org.sonarsource.sonarlint.ls.backend.BackendService.ROOT_CONFIGURATION_SCOPE;

public class ModuleEventsProcessor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import static java.util.Arrays.stream;
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.sonarsource.sonarlint.ls.backend.BackendServiceFacade.ROOT_CONFIGURATION_SCOPE;
import static org.sonarsource.sonarlint.ls.backend.BackendService.ROOT_CONFIGURATION_SCOPE;
import static org.sonarsource.sonarlint.ls.util.Utils.interrupted;

public class SettingsManager implements WorkspaceFolderLifecycleListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void getConfigScopeDtoWithBinding() {
var result = underTest.getConfigScopeDto(new WorkspaceFolder(workspaceUri), Optional.of(bindingWrapper));

assertThat(result.getId()).isEqualTo(workspaceUri);
assertThat(result.getParentId()).isEqualTo(BackendServiceFacade.ROOT_CONFIGURATION_SCOPE);
assertThat(result.getParentId()).isEqualTo(BackendService.ROOT_CONFIGURATION_SCOPE);
assertThat(result.getBinding().getConnectionId()).isEqualTo(connectionId);
}

Expand All @@ -112,7 +112,7 @@ void getConfigScopeDtoWithoutBinding() {
var result = underTest.getConfigScopeDto(new WorkspaceFolder(workspaceUri), Optional.empty());

assertThat(result.getId()).isEqualTo(workspaceUri);
assertThat(result.getParentId()).isEqualTo(BackendServiceFacade.ROOT_CONFIGURATION_SCOPE);
assertThat(result.getParentId()).isEqualTo(BackendService.ROOT_CONFIGURATION_SCOPE);
assertThat(result.getBinding().getConnectionId()).isNull();
assertThat(result.getBinding().getSonarProjectKey()).isNull();
assertThat(result.getBinding().isBindingSuggestionDisabled()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void should_get_client_file_dto_outside_workspace_folder() {
assertThat(clientFileDto).isNotNull();
assertThat(clientFileDto.getDetectedLanguage()).isEqualTo(Language.PYTHON);
assertThat(clientFileDto.getContent()).isEqualTo(content);
assertThat(clientFileDto.getConfigScopeId()).isEqualTo(BackendServiceFacade.ROOT_CONFIGURATION_SCOPE);
assertThat(clientFileDto.getConfigScopeId()).isEqualTo(BackendService.ROOT_CONFIGURATION_SCOPE);
assertThat(clientFileDto.getUri()).hasToString(testFile1.getUri().toString());
assertThat(clientFileDto.getCharset()).isEqualTo(StandardCharsets.UTF_8.name());
}
Expand Down Expand Up @@ -116,4 +116,4 @@ void should_notify_backend_on_watched_files_change() {
assertThat(deletedFilesCaptor.getValue()).hasSize(1);
assertThat(deletedFilesCaptor.getValue().get(0)).hasToString("file:///tmp/test3.py");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void prepare() {
when(bindingManager.getBinding(URI.create(""))).thenReturn(Optional.of(mock(ProjectBinding.class)));
when(backendServiceFacade.getBackendService()).thenReturn(backendService);
when(backendService.getConfigScopeDto(any(), any()))
.thenReturn(new ConfigurationScopeDto("id", BackendServiceFacade.ROOT_CONFIGURATION_SCOPE, true, "name",
.thenReturn(new ConfigurationScopeDto("id", BackendService.ROOT_CONFIGURATION_SCOPE, true, "name",
new BindingConfigurationDto("connectionId", "projectKey", true)));
underTest.setBindingManager(bindingManager);
}
Expand Down
Loading