Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void should_transpile_jsp() throws Exception {

MavenBuild build = TestUtils.createMavenBuild().setPom(TestUtils.projectPom(PROJECT))
.setCleanPackageSonarGoals()
.setDebugLogs(true)
.setProperty("org.slf4j.simpleLogger.log.org.sonarsource", "debug")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic duplication: The property key "org.slf4j.simpleLogger.log.org.sonarsource" and value "debug" appear verbatim in all five changed call sites across four test classes. If the target package ever changes (e.g., to org.sonar), all five need to be updated in sync — a non-obvious scatter.

Consider extracting a constant and a helper in TestUtils, e.g.:

// TestUtils.java
public static MavenBuild withTargetedDebugLogs(MavenBuild build) {
    return build.setProperty("org.slf4j.simpleLogger.log.org.sonarsource", "debug");
}

Then every call site becomes TestUtils.withTargetedDebugLogs(build), matching the pattern already used for other shared build setup in that class.

  • Mark as noise

.setProperty("sonar.scm.disabled", "true");
TestUtils.provisionProject(ENTERPRISE_ORCHESTRATOR_OR_NULL, "org.sonarsource.it.projects:" + PROJECT, PROJECT, "java", "jsp");
BuildResult buildResult = ENTERPRISE_ORCHESTRATOR_OR_NULL.executeBuild(build);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void test() {
MavenBuild build = TestUtils.createMavenBuild()
.setPom(TestUtils.projectPom("java-features"))
.setCleanPackageSonarGoals()
.setDebugLogs(true);
.setProperty("org.slf4j.simpleLogger.log.org.sonarsource", "debug");

String projectKey = "org.sonarsource.it.projects:parent-project";
TestUtils.provisionProject(orchestrator, projectKey, "java-features", "java", "multi-module");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void test() {
MavenBuild build = TestUtils.createMavenBuild()
.setPom(TestUtils.projectPom("java-tutorial"))
.setCleanPackageSonarGoals()
.setDebugLogs(true);
.setProperty("org.slf4j.simpleLogger.log.org.sonarsource", "debug");
String projectKey = "org.sonarsource.it.projects:java-tutorial";
TestUtils.provisionProject(orchestrator, projectKey, "java-tutorial", "java", "java-tutorial");
executeAndAssertBuild(build, projectKey);
Expand All @@ -54,7 +54,7 @@ public void test_as_batch_mode() {
.setProperty("sonar.projectKey", projectKey)
.setProperty("sonar.projectName", projectName)
.setProperty("sonar.java.experimental.batchModeSizeInKB", "8000")
.setDebugLogs(true);
.setProperty("org.slf4j.simpleLogger.log.org.sonarsource", "debug");
TestUtils.provisionProject(orchestrator, projectKey, projectName, "java", "java-tutorial");
executeAndAssertBuild(build, projectKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void test() {
MavenBuild build = TestUtils.createMavenBuild()
.setPom(TestUtils.projectPom("multi-module"))
.setCleanPackageSonarGoals()
.setDebugLogs(true);
.setProperty("org.slf4j.simpleLogger.log.org.sonarsource", "debug");

String projectKey = "org.sonarsource.it.projects:parent-project";
TestUtils.provisionProject(orchestrator, projectKey, "multi-module", "java", "multi-module");
Expand Down
Loading