Added support for collections as arguments

This commit is contained in:
Erik C. Thauvin 2023-08-28 14:50:36 -07:00
parent 357585693a
commit 5c85cddf0d

View file

@ -26,10 +26,7 @@ import rife.bld.operations.AbstractOperation;
import java.net.URI; import java.net.URI;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -162,6 +159,29 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this; return this;
} }
/**
* Adds new rule set paths.
* <p>
* The built-in rule set paths are:
* <ul>
* <li>{@code rulesets/java/quickstart.xml}</li>
* <li>{@code category/java/bestpractices.xml}</li>
* <li>{@code category/java/codestyle.xml}</li>
* <li>{@code category/java/design.xml}</li>
* <li>{@code category/java/documentation.xml}</li>
* <li>{@code category/java/errorprone.xml}</li>
* <li>{@code category/java/multithreading.xml}</li>
* <li>{@code category/java/performance.xml}</li>
* <li>{@code category/java/security.xml}</li>
* </ul>
*
* @see #ruleSets(Collection)
*/
public PmdOperation addRuleSet(Collection<String> ruleSet) {
ruleSets.addAll(ruleSet);
return this;
}
/** /**
* Sets the location of the cache file for incremental analysis. * Sets the location of the cache file for incremental analysis.
*/ */
@ -421,6 +441,30 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this; return this;
} }
/**
* Sets the rule set path(s), disregarding any previously set paths.
* <p>
* The built-in rule set paths are:
* <ul>
* <li>{@code rulesets/java/quickstart.xml}</li>
* <li>{@code category/java/bestpractices.xml}</li>
* <li>{@code category/java/codestyle.xml}</li>
* <li>{@code category/java/design.xml}</li>
* <li>{@code category/java/documentation.xml}</li>
* <li>{@code category/java/errorprone.xml}</li>
* <li>{@code category/java/multithreading.xml}</li>
* <li>{@code category/java/performance.xml}</li>
* <li>{@code category/java/security.xml}</li>
* </ul>
*
* @see #addRuleSet(Collection)
*/
public PmdOperation ruleSets(Collection<String> ruleSet) {
ruleSets.clear();
ruleSets.addAll(ruleSet);
return this;
}
/** /**
* Enables or disables adding the suppressed rule violations to the report. * Enables or disables adding the suppressed rule violations to the report.
*/ */