diff --git a/src/main/java/org/sonarsource/sonarlint/ls/AnalysisHelper.java b/src/main/java/org/sonarsource/sonarlint/ls/AnalysisHelper.java index 9de3954de..99736f9ce 100644 --- a/src/main/java/org/sonarsource/sonarlint/ls/AnalysisHelper.java +++ b/src/main/java/org/sonarsource/sonarlint/ls/AnalysisHelper.java @@ -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; diff --git a/src/main/java/org/sonarsource/sonarlint/ls/SonarLintLanguageServer.java b/src/main/java/org/sonarsource/sonarlint/ls/SonarLintLanguageServer.java index aea662a9c..2dd848342 100644 --- a/src/main/java/org/sonarsource/sonarlint/ls/SonarLintLanguageServer.java +++ b/src/main/java/org/sonarsource/sonarlint/ls/SonarLintLanguageServer.java @@ -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; diff --git a/src/main/java/org/sonarsource/sonarlint/ls/backend/BackendService.java b/src/main/java/org/sonarsource/sonarlint/ls/backend/BackendService.java index b84c9c8aa..c7b77b3d3 100644 --- a/src/main/java/org/sonarsource/sonarlint/ls/backend/BackendService.java +++ b/src/main/java/org/sonarsource/sonarlint/ls/backend/BackendService.java @@ -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 = ""; + private final SonarLintRpcServer backend; private final LanguageClientLogger logOutput; private final SonarLintExtendedLanguageClient client; diff --git a/src/main/java/org/sonarsource/sonarlint/ls/backend/BackendServiceFacade.java b/src/main/java/org/sonarsource/sonarlint/ls/backend/BackendServiceFacade.java index 838b2b85e..140b02854 100644 --- a/src/main/java/org/sonarsource/sonarlint/ls/backend/BackendServiceFacade.java +++ b/src/main/java/org/sonarsource/sonarlint/ls/backend/BackendServiceFacade.java @@ -63,8 +63,6 @@ public class BackendServiceFacade { private static final int DEFAULT_INIT_TIMEOUT_SECONDS = 60; - public static final String ROOT_CONFIGURATION_SCOPE = ""; - private final int initTimeoutSeconds; private final BackendService backendService; private final BackendInitParams initParams; @@ -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) ); } diff --git a/src/main/java/org/sonarsource/sonarlint/ls/clientapi/SonarLintVSCodeClient.java b/src/main/java/org/sonarsource/sonarlint/ls/clientapi/SonarLintVSCodeClient.java index 0b2852eeb..1d15fff0a 100644 --- a/src/main/java/org/sonarsource/sonarlint/ls/clientapi/SonarLintVSCodeClient.java +++ b/src/main/java/org/sonarsource/sonarlint/ls/clientapi/SonarLintVSCodeClient.java @@ -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; diff --git a/src/main/java/org/sonarsource/sonarlint/ls/folders/ModuleEventsProcessor.java b/src/main/java/org/sonarsource/sonarlint/ls/folders/ModuleEventsProcessor.java index 1134467b9..560a2d759 100644 --- a/src/main/java/org/sonarsource/sonarlint/ls/folders/ModuleEventsProcessor.java +++ b/src/main/java/org/sonarsource/sonarlint/ls/folders/ModuleEventsProcessor.java @@ -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 { diff --git a/src/main/java/org/sonarsource/sonarlint/ls/settings/SettingsManager.java b/src/main/java/org/sonarsource/sonarlint/ls/settings/SettingsManager.java index b360f48d3..a744a76ad 100644 --- a/src/main/java/org/sonarsource/sonarlint/ls/settings/SettingsManager.java +++ b/src/main/java/org/sonarsource/sonarlint/ls/settings/SettingsManager.java @@ -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 { diff --git a/src/test/java/org/sonarsource/sonarlint/ls/backend/BackendServiceTests.java b/src/test/java/org/sonarsource/sonarlint/ls/backend/BackendServiceTests.java index 746d42f67..b45757370 100644 --- a/src/test/java/org/sonarsource/sonarlint/ls/backend/BackendServiceTests.java +++ b/src/test/java/org/sonarsource/sonarlint/ls/backend/BackendServiceTests.java @@ -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); } @@ -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(); diff --git a/src/test/java/org/sonarsource/sonarlint/ls/folders/ModuleEventsProcessorTest.java b/src/test/java/org/sonarsource/sonarlint/ls/folders/ModuleEventsProcessorTest.java index de9f8193e..a41254cd5 100644 --- a/src/test/java/org/sonarsource/sonarlint/ls/folders/ModuleEventsProcessorTest.java +++ b/src/test/java/org/sonarsource/sonarlint/ls/folders/ModuleEventsProcessorTest.java @@ -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()); } @@ -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"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/sonarsource/sonarlint/ls/folders/WorkspaceFoldersManagerTests.java b/src/test/java/org/sonarsource/sonarlint/ls/folders/WorkspaceFoldersManagerTests.java index 7e7bb5f95..aceaf4b98 100644 --- a/src/test/java/org/sonarsource/sonarlint/ls/folders/WorkspaceFoldersManagerTests.java +++ b/src/test/java/org/sonarsource/sonarlint/ls/folders/WorkspaceFoldersManagerTests.java @@ -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); }