2.2 KiB
Executable file
2.2 KiB
Executable file
bld Extension to Perform Static Code Analysis with PMD
To install, please refer to the extensions documentation.
To check all source code using the Java Quickstart configuration, add the following to your build file:
@BuildCommand(summary = "Checks source code with PMD")
public void pmd() throws Exception {
new PmdOperation()
.fromProject(this)
.execute();
}
./bld pmd test
To check the main source directory using a custom ruleset, Java Error Prone configuration, and failing on any violation.
@BuildCommand(value = "pmd-main", summary = "Checks main source code with PMD")
public void pmdMain() throws Exception {
new PmdOperation()
.fromProject(this)
.failOnViolation(true)
.inputPaths(srcMainDirectory())
.ruleSets("config/pmd.xml", "category/java/errorprone.xml")
.execute();
}
./bld compile pmd-main
Please check the PmdOperation documentation for all available configuration options.