diff --git a/README.md b/README.md deleted file mode 100755 index d4ef9b9..0000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [Bld](https://rife2.com/bld) Extension to Perform Static Code Analysis with [PMD](https://pmd.github.io/) - - -[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) -[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) -[![GitHub CI](https://github.com/rife2/bld-pmd/actions/workflows/bld.yml/badge.svg)](https://github.com/rife2/bld-pmd/actions/workflows/bld.yml) - -To check all source code using the [java quickstart rule](https://pmd.github.io/pmd/pmd_rules_java.html). - -```java -@BuildCommand -public void pmd() throws Exception { - new PmdOperation(this).execute(); -} -``` -```text -./bld pmd test -``` - -To check the main source code using a custom rule, [java error prone rule](https://pmd.github.io/pmd/pmd_rules_java.html) and failing on any violation. - -```java -@BuildCommand -public void pmdMain() throws Exception { - new PmdOperation(this) - .failOnValidation(true) - .addInputPath(project.srcMainDirectory().toPath()) - .addRuletSet("config/pmd.xml", "category/java/errorprone.xml"); - .execute(); -} -``` - -```text -./dld compile pmdMain -``` - -Please check the [PmdOperation documentation](https://rife2.github.io/bld-pmd/rife/bld/extension/PmdOperation.html#method-summary) for all available configuration options. \ No newline at end of file diff --git a/src/main/java/rife/bld/extension/PmdOperation.java b/src/main/java/rife/bld/extension/PmdOperation.java index a8ea894..a9499dc 100644 --- a/src/main/java/rife/bld/extension/PmdOperation.java +++ b/src/main/java/rife/bld/extension/PmdOperation.java @@ -43,13 +43,12 @@ public class PmdOperation extends AbstractOperation { /** * The default rule set. */ - public static final String RULE_SET_DEFAULT = "rulesets/java/quickstart.xml"; + public static final String RULESET_DEFAULT = "rulesets/java/quickstart.xml"; private static final Logger LOGGER = Logger.getLogger(PmdOperation.class.getName()); private static final String PMD_DIR = "pmd"; /** * The cache location. - * */ Path cache; /** @@ -155,21 +154,21 @@ public class PmdOperation extends AbstractOperation { inputPaths.add(project.srcMainDirectory().toPath()); inputPaths.add(project.srcTestDirectory().toPath()); - ruleSets.add(RULE_SET_DEFAULT); + ruleSets.add(RULESET_DEFAULT); } /** - * Adds paths to source files, or directories containing source files to analyze. + * Adds the path to a source file, or directory containing source files to analyze. * * @see #inputPaths(Path...) */ - public PmdOperation addInputPath(Path... inputPath) { - inputPaths.addAll(List.of(inputPath)); + public PmdOperation addInputPath(Path inputPath) { + inputPaths.add(inputPath); return this; } /** - * Adds new rule set paths. + * Adds a new rule set path. *

* The built-in rule set paths are: *