From 0a716260ac7e9b7914df33dd7cda69a8d08ffcc9 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Thu, 23 May 2024 21:52:42 -0700 Subject: [PATCH 1/4] Normalized execution logging messages --- src/main/java/rife/bld/extension/DetektOperation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/rife/bld/extension/DetektOperation.java b/src/main/java/rife/bld/extension/DetektOperation.java index 7541107..6104037 100644 --- a/src/main/java/rife/bld/extension/DetektOperation.java +++ b/src/main/java/rife/bld/extension/DetektOperation.java @@ -257,10 +257,10 @@ public class DetektOperation extends AbstractProcessOperation { super.execute(); if (successful_ && LOGGER.isLoggable(Level.INFO)) { if (createBaseline_) { - LOGGER.info("Detekt baseline successfully generated: " + LOGGER.info("Detekt baseline generated successfully: " + "file://" + new File(baseline_).toURI().getPath()); } else { - LOGGER.info("Detekt executed successfully."); + LOGGER.info("Detekt operation finished successfully."); } } } From 833eddf28cfded72a757ebd509b0b9a079cbc4fc Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Thu, 23 May 2024 22:05:56 -0700 Subject: [PATCH 2/4] Bumped Kotlin to version 2.0.0 --- examples/lib/bld/bld-wrapper.properties | 2 +- examples/src/bld/java/com/example/ExampleBuild.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties index dfa1d5b..7a088fe 100644 --- a/examples/lib/bld/bld-wrapper.properties +++ b/examples/lib/bld/bld-wrapper.properties @@ -1,6 +1,6 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true -bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.4 +bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.7 bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.4 bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.downloadLocation= diff --git a/examples/src/bld/java/com/example/ExampleBuild.java b/examples/src/bld/java/com/example/ExampleBuild.java index 9c02b47..32e06e4 100644 --- a/examples/src/bld/java/com/example/ExampleBuild.java +++ b/examples/src/bld/java/com/example/ExampleBuild.java @@ -31,7 +31,7 @@ public class ExampleBuild extends Project { repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES); - final var kotlin = version(1, 9, 24); + final var kotlin = version(2, 0, 0); scope(compile) .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)); scope(test) From 61c200ee541844c71f9d8fa4c27d442ee6c80213 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 26 May 2024 17:39:06 -0700 Subject: [PATCH 3/4] Bumped assertj-core to version 3.26.0 --- src/bld/java/rife/bld/extension/DetektOperationBuild.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bld/java/rife/bld/extension/DetektOperationBuild.java b/src/bld/java/rife/bld/extension/DetektOperationBuild.java index 6c87b41..1c830e1 100644 --- a/src/bld/java/rife/bld/extension/DetektOperationBuild.java +++ b/src/bld/java/rife/bld/extension/DetektOperationBuild.java @@ -47,7 +47,7 @@ public class DetektOperationBuild extends Project { scope(test) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2))) - .include(dependency("org.assertj", "assertj-core", version(3, 25, 3))); + .include(dependency("org.assertj", "assertj-core", version(3, 26, 0))); javadocOperation() .javadocOptions() .author() From 6fa52100ecaa47bbfbcd90df6b1434a3ea90a9c9 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 26 May 2024 17:59:39 -0700 Subject: [PATCH 4/4] Added test for all parameters --- .idea/misc.xml | 14 ---- .../bld/extension/DetektOperationBuild.java | 2 +- .../rife/bld/extension/DetektOperation.java | 2 +- .../bld/extension/DetektOperationTest.java | 69 +++++++++++++++++++ 4 files changed, 71 insertions(+), 16 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 22c7683..cf8a3be 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,20 +3,6 @@ - - - diff --git a/src/bld/java/rife/bld/extension/DetektOperationBuild.java b/src/bld/java/rife/bld/extension/DetektOperationBuild.java index 1c830e1..15bf2ff 100644 --- a/src/bld/java/rife/bld/extension/DetektOperationBuild.java +++ b/src/bld/java/rife/bld/extension/DetektOperationBuild.java @@ -34,7 +34,7 @@ public class DetektOperationBuild extends Project { public DetektOperationBuild() { pkg = "rife.bld.extension"; name = "DetektOperation"; - version = version(0, 9, 4); + version = version(0, 9, 5, "SNAPSHOT"); javaRelease = 17; downloadSources = true; diff --git a/src/main/java/rife/bld/extension/DetektOperation.java b/src/main/java/rife/bld/extension/DetektOperation.java index 6104037..6db96db 100644 --- a/src/main/java/rife/bld/extension/DetektOperation.java +++ b/src/main/java/rife/bld/extension/DetektOperation.java @@ -402,7 +402,7 @@ public class DetektOperation extends AbstractProcessOperation { // report if (!report_.isEmpty()) { report_.forEach(it -> { - args.add("-r"); + args.add("--report"); args.add(it.id().name().toLowerCase() + ":" + it.path()); }); } diff --git a/src/test/java/rife/bld/extension/DetektOperationTest.java b/src/test/java/rife/bld/extension/DetektOperationTest.java index dd3e4f4..26e42e6 100644 --- a/src/test/java/rife/bld/extension/DetektOperationTest.java +++ b/src/test/java/rife/bld/extension/DetektOperationTest.java @@ -18,6 +18,7 @@ package rife.bld.extension; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import rife.bld.BaseProject; import rife.bld.blueprints.BaseProjectBlueprint; import rife.bld.operations.exceptions.ExitStatusException; @@ -57,6 +58,74 @@ class DetektOperationTest { } } + @Test + void testCheckAllParameters() { + var params = List.of( + "--all-rules", + "--auto-correct", + "--base-path", + "--baseline", + "--build-upon-default-config", + "--classpath", + "--config", + "--config-resource", + "--create-baseline", + "--debug", + "--disable-default-rulesets", + "--excludes", + "--generate-config", + "--includes", + "--input", + "--jdk-home", + "--jvm-target", + "--language-version", + "--max-issues", + "--parallel", + "--plugins", + "--report" + ); + + var args = new DetektOperation() + .fromProject(new BaseProject()) + .allRules(true) + .autoCorrect(true) + .basePath("basePath") + .baseline("baseline") + .buildUponDefaultConfig(true) + .classPath("classpath") + .classPath(List.of("path2", "path3")) + .config("config") + .config(List.of("config2", "config4")) + .configResource("configResource") + .createBaseline(true) + .debug(true) + .disableDefaultRuleSets(true) + .excludes("excludes") + .generateConfig(true) + .includes("patterns") + .input("input") + .jdkHome("jdkHome") + .jvmTarget("jvmTarget") + .languageVersion("languageVersion") + .maxIssues(10) + .parallel(true) + .plugins("jars") + .plugins(List.of("jars2", "jar3")) + .report(new DetektReport(DetektReportId.HTML, "reports")) + .executeConstructProcessCommandList(); + + for (var p : params) { + var found = false; + for (var a : args) { + if (a.startsWith(p)) { + found = true; + break; + } + } + assertThat(found).as(p + " not found.").isTrue(); + } + } + @Test void testExampleBaseline() throws IOException, ExitStatusException, InterruptedException { var tmpDir = Files.createTempDirectory("bld-detekt-").toFile();