From 5d24b4060a24ea288a42246b570e86ba56c25c49 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 29 Apr 2024 03:46:25 -0700 Subject: [PATCH] Fixed exclude options to support multiple values --- .../bld/extension/CheckstyleOperation.java | 49 ++++++++++++++++--- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/src/main/java/rife/bld/extension/CheckstyleOperation.java b/src/main/java/rife/bld/extension/CheckstyleOperation.java index 681e992..ff04d8b 100644 --- a/src/main/java/rife/bld/extension/CheckstyleOperation.java +++ b/src/main/java/rife/bld/extension/CheckstyleOperation.java @@ -32,6 +32,8 @@ import java.util.logging.Logger; */ public class CheckstyleOperation extends AbstractProcessOperation { private static final Logger LOGGER = Logger.getLogger(CheckstyleOperation.class.getName()); + protected final List exclude = new ArrayList<>(); + protected final List excludeRegex = new ArrayList<>(); /** * The command line options. */ @@ -97,7 +99,7 @@ public class CheckstyleOperation extends AbstractProcessOperation paths) { for (var p : paths) { if (isNotBlank(p)) { - options.put("-e", p); + exclude.add(p); } } return this; } /** - * Directory/file pattern to exclude from CheckStyle. Multiple excludes are allowed. + * Directory/file pattern to exclude from CheckStyle. Multiple exclude are allowed. * - * @param pattern the pattern + * @param regex the pattern to exclude * @return the checkstyle operation + * @see #excludeRegex(Collection) */ - public CheckstyleOperation excludedPathPattern(String pattern) { - if (isNotBlank(pattern)) { - options.put("-x", pattern); + public CheckstyleOperation excludeRegex(String... regex) { + for (var r : regex) { + if (isNotBlank(r)) { + excludeRegex.add(r); } + return this; + /** + * Directory/file pattern to exclude from CheckStyle. Multiple exclude are allowed. + * + * @param regex the patterns to exclude + * @return the checkstyle operation + * @see #excludeRegex(String...) + */ + public CheckstyleOperation excludeRegex(Collection regex) { + for (var r : regex) { + if (isNotBlank(r)) { + excludeRegex.add(r); + } + } + return this; } @@ -162,6 +181,20 @@ public class CheckstyleOperation extends AbstractProcessOperation