Skip to content

Latest commit

 

History

History
executable file
·
45 lines (36 loc) · 2.2 KB

README.md

File metadata and controls

executable file
·
45 lines (36 loc) · 2.2 KB

bld Extension to Perform Static Code Analysis with PMD

License Java bld Release Snapshot GitHub CI

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.