Skip to content

Commit

Permalink
SLCORE-988 be explicit about SonarCloud in docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sophio-japharidze-sonarsource committed Oct 23, 2024
1 parent c6807e7 commit 2bff000
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion API_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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
* The method returns a boolean value indicating whether the enterprise C# analyzer should be used or not
* The method returns `true` if a binding exists for config scope AND the related connected server has the enterprise C# plugin (`csharpenterprise`) installed
* The method returns `true` if binding exists with a SonarQube version < 10.8 (i.e. SQ versions that do not include repackaged dotnet analyzer)
* 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

# 10.7.1

Expand Down
15 changes: 14 additions & 1 deletion its/tests/src/test/java/its/SonarCloudTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import org.sonarsource.sonarlint.core.rpc.impl.BackendJsonRpcLauncher;
import org.sonarsource.sonarlint.core.rpc.protocol.SonarLintRpcServer;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.analysis.AnalyzeFilesParams;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.analysis.ShouldUseEnterpriseCSharpAnalyzerParams;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.branch.GetMatchedSonarProjectBranchParams;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.binding.BindingConfigurationDto;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.binding.DidUpdateBindingParams;
Expand Down Expand Up @@ -134,7 +135,7 @@ class SonarCloudTests extends AbstractConnectedTests {
private static final URI SONARCLOUD_WEBSOCKETS_STAGING_URL = URI.create("wss://events-api.sc-staging.io/");
private static final String SONARCLOUD_ORGANIZATION = "sonarlint-it";
private static final String SONARCLOUD_USER = "sonarlint-it";
private static final String SONARCLOUD_PASSWORD = System.getenv("SONARCLOUD_IT_PASSWORD");
private static final String SONARCLOUD_PASSWORD = "4JkX0n1rhDrIUs7TWhYnz";

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

@Test
void should_use_enterprise_csharp_analyzer_with_sonarcloud() {
// the project and config scope names do not matter
var configScopeId = "match_main_branch_by_default";
openBoundConfigurationScope(configScopeId, PROJECT_KEY_JAVA);
waitForAnalysisToBeReady(configScopeId);

var shouldUseEnterpriseAnalyzer = backend.getAnalysisService().shouldUseEnterpriseCSharpAnalyzer(new ShouldUseEnterpriseCSharpAnalyzerParams(configScopeId)).join();

await().untilAsserted(() -> assertThat(shouldUseEnterpriseAnalyzer.shouldUseEnterpriseAnalyzer()).isTrue());
}

@Test
void getAllProjects() {
provisionProject("foo-bar", "Foo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public interface AnalysisRpcService {
* 2. configScope is bound to a SonarQube server that does not have enterprise CSharp analyzer -> false
* 3. configScope is bound to a SonarQube server that has enterprise CSharp analyzer -> true
* 4. configScope is bound to a SonarQube server that does not have repackaged analyzer (<10.8) -> true
* 5. configScope is bound to SonarCloud -> true
*/
@JsonRequest
CompletableFuture<ShouldUseEnterpriseCSharpAnalyzerResponse> shouldUseEnterpriseCSharpAnalyzer(ShouldUseEnterpriseCSharpAnalyzerParams params);
Expand Down

0 comments on commit 2bff000

Please sign in to comment.