From 5c85cddf0df8a8eb76f2a0fc12d99818aacc85b8 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 28 Aug 2023 14:50:36 -0700 Subject: [PATCH] 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. */