From 5c85cddf0df8a8eb76f2a0fc12d99818aacc85b8 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 28 Aug 2023 14:50:36 -0700 Subject: [PATCH 1/2] Added support for collections as arguments --- .../java/rife/bld/extension/PmdOperation.java | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/src/main/java/rife/bld/extension/PmdOperation.java b/src/main/java/rife/bld/extension/PmdOperation.java index 303bf43..51e8036 100644 --- a/src/main/java/rife/bld/extension/PmdOperation.java +++ b/src/main/java/rife/bld/extension/PmdOperation.java @@ -26,10 +26,7 @@ import rife.bld.operations.AbstractOperation; import java.net.URI; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; @@ -162,6 +159,29 @@ public class PmdOperation extends AbstractOperation { return this; } + /** + * Adds new rule set paths. + *

+ * The built-in rule set paths are: + *

+ * + * @see #ruleSets(Collection) + */ + public PmdOperation addRuleSet(Collection ruleSet) { + ruleSets.addAll(ruleSet); + return this; + } + /** * Sets the location of the cache file for incremental analysis. */ @@ -421,6 +441,30 @@ public class PmdOperation extends AbstractOperation { return this; } + /** + * Sets the rule set path(s), disregarding any previously set paths. + *

+ * The built-in rule set paths are: + *

    + *
  • {@code rulesets/java/quickstart.xml}
  • + *
  • {@code category/java/bestpractices.xml}
  • + *
  • {@code category/java/codestyle.xml}
  • + *
  • {@code category/java/design.xml}
  • + *
  • {@code category/java/documentation.xml}
  • + *
  • {@code category/java/errorprone.xml}
  • + *
  • {@code category/java/multithreading.xml}
  • + *
  • {@code category/java/performance.xml}
  • + *
  • {@code category/java/security.xml}
  • + *
+ * + * @see #addRuleSet(Collection) + */ + public PmdOperation ruleSets(Collection ruleSet) { + ruleSets.clear(); + ruleSets.addAll(ruleSet); + return this; + } + /** * Enables or disables adding the suppressed rule violations to the report. */ From 77b7d64852535949b7284161bfa774eb463defff Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 28 Aug 2023 14:52:13 -0700 Subject: [PATCH 2/2] Updated copyright --- .github/workflows/bld.yml | 4 ++-- .idea/copyright/Apache_License.xml | 2 +- .idea/misc.xml | 2 ++ README.md | 2 +- .../rife/bld/extension/PmdOperationBuild.java | 16 +++++++++++++++ .../java/rife/bld/extension/PmdOperation.java | 20 +++++++++---------- .../rife/bld/extension/PmdOperationTest.java | 20 +++++++++---------- 7 files changed, 42 insertions(+), 24 deletions(-) diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index ddcc35c..2b0ba38 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - java-version: [ 17, 19, 20 ] + java-version: [ 17, 20 ] steps: - name: Checkout source repository @@ -29,4 +29,4 @@ jobs: run: ./bld download - name: Run tests with bld - run: ./bld compile test \ No newline at end of file + run: ./bld compile test diff --git a/.idea/copyright/Apache_License.xml b/.idea/copyright/Apache_License.xml index 206aa7d..15687f4 100644 --- a/.idea/copyright/Apache_License.xml +++ b/.idea/copyright/Apache_License.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index dbe3041..d573dd7 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -32,6 +33,7 @@