diff --git a/config/pmd.xml b/config/pmd.xml new file mode 100644 index 0000000..cb0b643 --- /dev/null +++ b/config/pmd.xml @@ -0,0 +1,110 @@ + + + Erik's Ruleset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index 1eff7d0..ca9cd8d 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -1,6 +1,6 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true -bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1 +bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.4 bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.downloadLocation= bld.sourceDirectories= diff --git a/src/bld/java/rife/bld/extension/DetektOperationBuild.java b/src/bld/java/rife/bld/extension/DetektOperationBuild.java index 42ddb5f..957b95b 100644 --- a/src/bld/java/rife/bld/extension/DetektOperationBuild.java +++ b/src/bld/java/rife/bld/extension/DetektOperationBuild.java @@ -16,6 +16,7 @@ package rife.bld.extension; +import rife.bld.BuildCommand; import rife.bld.Project; import rife.bld.publish.PublishDeveloper; import rife.bld.publish.PublishLicense; @@ -93,4 +94,13 @@ public class DetektOperationBuild extends Project { public static void main(String[] args) { new DetektOperationBuild().start(args); } + + @BuildCommand(summary = "Check source code with PMD") + public void pmd() throws Exception { + new PmdOperation() + .fromProject(this) + .addRuleSet("config/pmd.xml") + .execute(); + } + } \ No newline at end of file diff --git a/src/main/java/rife/bld/extension/DetektOperation.java b/src/main/java/rife/bld/extension/DetektOperation.java index 882d460..41630f9 100644 --- a/src/main/java/rife/bld/extension/DetektOperation.java +++ b/src/main/java/rife/bld/extension/DetektOperation.java @@ -40,15 +40,15 @@ public class DetektOperation extends AbstractProcessOperation { private final Collection input_ = new ArrayList<>(); private final Collection plugins_ = new ArrayList<>(); private final Collection report_ = new ArrayList<>(); - private boolean allRules_ = false; - private boolean autoCorrect_ = false; + private boolean allRules_; + private boolean autoCorrect_; private String basePath_; private String baseline_; private boolean buildUponDefaultConfig_; private String configResource_; private boolean createBaseline_; - private boolean debug_ = false; - private boolean disableDefaultRuleSets_ = false; + private boolean debug_; + private boolean disableDefaultRuleSets_; private String excludes_; private boolean generateConfig_; private String includes_; @@ -514,9 +514,7 @@ public class DetektOperation extends AbstractProcessOperation { } /** - * Enables parallel compilation and analysis of source files. Do some - * benchmarks first before enabling this flag. Heuristics show performance - * benefits starting from 2000 lines of Kotlin code. + * Extra paths to plugin jars. * * @param jars one or more jars * @return this operation instance @@ -527,9 +525,7 @@ public class DetektOperation extends AbstractProcessOperation { } /** - * Enables parallel compilation and analysis of source files. Do some - * benchmarks first before enabling this flag. Heuristics show performance - * benefits starting from 2000 lines of Kotlin code. + * Extra paths to plugin jars. * * @param jars the list of jars * @return this operation instance diff --git a/src/test/java/rife/bld/extension/DetektOperationTest.java b/src/test/java/rife/bld/extension/DetektOperationTest.java index 0cf4551..d22704d 100644 --- a/src/test/java/rife/bld/extension/DetektOperationTest.java +++ b/src/test/java/rife/bld/extension/DetektOperationTest.java @@ -29,9 +29,10 @@ import java.util.logging.ConsoleHandler; import java.util.logging.Level; import java.util.logging.Logger; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.*; // NOPMD +@SuppressWarnings("PMD.AvoidDuplicateLiterals") class DetektOperationTest { @BeforeAll static void beforeAll() {