Skip to content

Commit

Permalink
SQ Plugin: Bump orchestrator to 5.0.0.2065 (#9551)
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-georgiou-sonarsource committed Jul 25, 2024
1 parent a5c109c commit acbaa86
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>org.sonarsource.orchestrator</groupId>
<artifactId>sonar-orchestrator-junit5</artifactId>
<version>4.9.0.1920</version>
<version>5.0.0.2065</version>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
Expand Down
34 changes: 18 additions & 16 deletions its/src/test/java/com/sonar/it/shared/ScannerCliTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,23 @@ class ScannerCliTest {
private static final String HTML_IN_MAIN_AND_CSHARP_IN_TEST_SUBFOLDERS = "ScannerCli";

// Note: setting the `sonar.projectBaseDir` only enables Incremental PR Analysis when used with the Scanner for .NET.
private static final String INCREMENTAL_PR_ANALYSIS_WARNING = "WARN: Incremental PR analysis: Could not determine common base path, cache will not be computed. Consider setting 'sonar.projectBaseDir' property.";
private static final String INCREMENTAL_PR_ANALYSIS_WARNING = "WARN Incremental PR analysis: Could not determine common base path, cache will not be computed. Consider setting 'sonar.projectBaseDir' property.";

@Test
void givenRazorPagesMainCode_whenScannerForCliIsUsed_logsCSharpWarning() {
// by default, the `sonar.sources` are in the scan base directory
SonarScanner scanner = getSonarScanner(RAZOR_PAGES_PROJECT, "projects/" + RAZOR_PAGES_PROJECT);
BuildResult result = ORCHESTRATOR.executeBuild(scanner);

assertThat(result.getLogsLines(l -> l.contains("WARN")))
.containsExactlyInAnyOrder(
"WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html",
"WARN: Your project contains VB.NET files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html",
INCREMENTAL_PR_ANALYSIS_WARNING,
INCREMENTAL_PR_ANALYSIS_WARNING
);
var logLines = result.getLogsLines(l -> l.contains("WARN"));

assertThat(logLines)
.hasSize(4)
.anyMatch(x -> x.endsWith("WARN Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html"))
.anyMatch(y -> y.endsWith("WARN Your project contains VB.NET files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html"));

assertThat(logLines.stream().filter(x -> x.endsWith(INCREMENTAL_PR_ANALYSIS_WARNING))).hasSize(2);

// The HTML plugin works
assertThat(TestUtils.getMeasureAsInt(ORCHESTRATOR, RAZOR_PAGES_PROJECT, "violations")).isEqualTo(2);
TestUtils.verifyNoGuiWarnings(ORCHESTRATOR, result);
Expand All @@ -65,10 +67,10 @@ void givenMainHtmlCodeAndTestCSharpCode_whenScannerForCliIsUsed_logsCSharpWarnin
BuildResult result = ORCHESTRATOR.executeBuild(scanner);

assertThat(result.getLogsLines(l -> l.contains("WARN")))
.containsExactlyInAnyOrder(
"WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html",
INCREMENTAL_PR_ANALYSIS_WARNING
);
.hasSize(2)
.anyMatch(x -> x.endsWith("WARN Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html"))
.anyMatch(y -> y.endsWith(INCREMENTAL_PR_ANALYSIS_WARNING));

// The HTML plugin works
assertThat(TestUtils.getMeasureAsInt(ORCHESTRATOR, HTML_IN_MAIN_AND_CSHARP_IN_TEST_SUBFOLDERS, "violations")).isEqualTo(2);
TestUtils.verifyNoGuiWarnings(ORCHESTRATOR, result);
Expand All @@ -82,10 +84,10 @@ void givenTestHtmlAndCSharpCode_whenScannerForCliIsUsed_logsCSharpWarning() {
BuildResult result = ORCHESTRATOR.executeBuild(scanner);

assertThat(result.getLogsLines(l -> l.contains("WARN")))
.containsExactlyInAnyOrder(
"WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html",
INCREMENTAL_PR_ANALYSIS_WARNING
);
.hasSize(2)
.anyMatch(y -> y.endsWith("WARN Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html"))
.anyMatch(z -> z.endsWith(INCREMENTAL_PR_ANALYSIS_WARNING));

TestUtils.verifyNoGuiWarnings(ORCHESTRATOR, result);
}

Expand Down

0 comments on commit acbaa86

Please sign in to comment.