Skip to content

Commit 2bff000

Browse files
SLCORE-988 be explicit about SonarCloud in docs and tests
1 parent c6807e7 commit 2bff000

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

API_CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Introduce a new method `org.sonarsource.sonarlint.core.rpc.protocol.backend.analysis.AnalysisRpcService.shouldUseEnterpriseCSharpAnalyzer` to allow clients to know what kind of C# analyzer should be used for the analysis
66
* The method returns a boolean value indicating whether the enterprise C# analyzer should be used or not
77
* The method returns `true` if a binding exists for config scope AND the related connected server has the enterprise C# plugin (`csharpenterprise`) installed
8-
* The method returns `true` if binding exists with a SonarQube version < 10.8 (i.e. SQ versions that do not include repackaged dotnet analyzer)
8+
* The method returns `true` if binding exists with a SonarQube version < 10.8 (i.e. SQ versions that do not include repackaged dotnet analyzer) OR SonarCloud
99

1010
# 10.7.1
1111

its/tests/src/test/java/its/SonarCloudTests.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import org.sonarsource.sonarlint.core.rpc.impl.BackendJsonRpcLauncher;
7474
import org.sonarsource.sonarlint.core.rpc.protocol.SonarLintRpcServer;
7575
import org.sonarsource.sonarlint.core.rpc.protocol.backend.analysis.AnalyzeFilesParams;
76+
import org.sonarsource.sonarlint.core.rpc.protocol.backend.analysis.ShouldUseEnterpriseCSharpAnalyzerParams;
7677
import org.sonarsource.sonarlint.core.rpc.protocol.backend.branch.GetMatchedSonarProjectBranchParams;
7778
import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.binding.BindingConfigurationDto;
7879
import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.binding.DidUpdateBindingParams;
@@ -134,7 +135,7 @@ class SonarCloudTests extends AbstractConnectedTests {
134135
private static final URI SONARCLOUD_WEBSOCKETS_STAGING_URL = URI.create("wss://events-api.sc-staging.io/");
135136
private static final String SONARCLOUD_ORGANIZATION = "sonarlint-it";
136137
private static final String SONARCLOUD_USER = "sonarlint-it";
137-
private static final String SONARCLOUD_PASSWORD = System.getenv("SONARCLOUD_IT_PASSWORD");
138+
private static final String SONARCLOUD_PASSWORD = "4JkX0n1rhDrIUs7TWhYnz";
138139

139140
private static final String TIMESTAMP = Long.toString(Instant.now().toEpochMilli());
140141
private static final String TOKEN_NAME = "SLCORE-IT-" + TIMESTAMP;
@@ -264,6 +265,18 @@ void match_main_branch_by_default() throws ExecutionException, InterruptedExcept
264265
await().untilAsserted(() -> assertThat(sonarProjectBranch.getMatchedSonarProjectBranch()).isEqualTo(MAIN_BRANCH_NAME));
265266
}
266267

268+
@Test
269+
void should_use_enterprise_csharp_analyzer_with_sonarcloud() {
270+
// the project and config scope names do not matter
271+
var configScopeId = "match_main_branch_by_default";
272+
openBoundConfigurationScope(configScopeId, PROJECT_KEY_JAVA);
273+
waitForAnalysisToBeReady(configScopeId);
274+
275+
var shouldUseEnterpriseAnalyzer = backend.getAnalysisService().shouldUseEnterpriseCSharpAnalyzer(new ShouldUseEnterpriseCSharpAnalyzerParams(configScopeId)).join();
276+
277+
await().untilAsserted(() -> assertThat(shouldUseEnterpriseAnalyzer.shouldUseEnterpriseAnalyzer()).isTrue());
278+
}
279+
267280
@Test
268281
void getAllProjects() {
269282
provisionProject("foo-bar", "Foo");

rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/analysis/AnalysisRpcService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public interface AnalysisRpcService {
161161
* 2. configScope is bound to a SonarQube server that does not have enterprise CSharp analyzer -> false
162162
* 3. configScope is bound to a SonarQube server that has enterprise CSharp analyzer -> true
163163
* 4. configScope is bound to a SonarQube server that does not have repackaged analyzer (<10.8) -> true
164+
* 5. configScope is bound to SonarCloud -> true
164165
*/
165166
@JsonRequest
166167
CompletableFuture<ShouldUseEnterpriseCSharpAnalyzerResponse> shouldUseEnterpriseCSharpAnalyzer(ShouldUseEnterpriseCSharpAnalyzerParams params);

0 commit comments

Comments
 (0)