MCP-318 Add SONARQUBE_IS_CLOUD env var to force SQC detection#239
MCP-318 Add SONARQUBE_IS_CLOUD env var to force SQC detection#239nquinquenel merged 1 commit intomasterfrom
Conversation
Remediation Agent Summary 📊
Suggested fixes (1)
Note Help us improve the Agent! |
Agent Fix (Issue 1 of 1)
Location 1: src/main/java/org/sonarsource/sonarqube/mcp/configuration/McpServerLaunchConfiguration.java:83-84 Review
🔒 Commit changes (0 of 1 selected) Did this fix help? |
b3f3ff1 to
4ef224a
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for a SONARQUBE_IS_CLOUD flag to force SonarCloud (SQC) detection in McpServerLaunchConfiguration, with accompanying unit tests to validate forced cloud vs non-cloud behavior.
Changes:
- Introduce
SONARQUBE_IS_CLOUDconfiguration key to override SonarCloud detection logic. - Update SonarCloud detection branching to honor the forced flag.
- Add tests covering forced SonarCloud detection in both HTTP and stdio modes, plus a “false” case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/org/sonarsource/sonarqube/mcp/configuration/McpServerLaunchConfiguration.java | Adds SONARQUBE_IS_CLOUD flag and updates SonarCloud detection logic to allow forced cloud mode. |
| src/test/java/org/sonarsource/sonarqube/mcp/configuration/McpServerLaunchConfigurationTest.java | Adds unit tests validating forced SonarCloud detection behavior. |
Comments suppressed due to low confidence (1)
src/main/java/org/sonarsource/sonarqube/mcp/configuration/McpServerLaunchConfiguration.java:147
- When
SONARQUBE_IS_CLOUDis set to true andSONARQUBE_URLis missing/blank, the configuration currently defaults tohttps://sonarcloud.io. Since the flag is intended for non-standard SonarCloud-like deployments, defaulting to the public SonarCloud URL can be surprising and may accidentally send credentials/traffic to the wrong endpoint. Consider requiring an explicitSONARQUBE_URL(throwing anIllegalArgumentException) whenSONARQUBE_IS_CLOUD=trueand no URL is provided.
var forceSonarQubeCloud = Boolean.parseBoolean(getValueViaEnvOrPropertyOrDefault(environment, SONARQUBE_IS_CLOUD, "false"));
if (forceSonarQubeCloud) {
this.isSonarCloud = true;
} else if (!isHttpEnabled) {
this.isSonarCloud = this.sonarqubeOrg != null;
} else {
this.isSonarCloud = sonarqubeUrlFromEnv == null || isSonarCloudUrl(sonarqubeUrlFromEnv);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…-standard deployments
4ef224a to
e82e559
Compare
SonarQube reviewer guide
|




No description provided.