bld-pmd/README.md

2.1 KiB
Executable file

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 rule, add the following to your build file

@BuildCommand
public void pmd() throws Exception {
    new PmdOperation()
        .fromProject(this)
        .execute();
}
./bld pmd test

To check the main source directory using a custom rule, java error prone rule and failing on any violation.

@BuildCommand
public void pmdMain() throws Exception {
    new PmdOperation()
            .fromProject(this)
            .failOnViolation(true)
            .inputPaths(this.srcMainDirectory().toPath())
            .ruleSets("config/pmd.xml", "category/java/errorprone.xml")
            .execute();
}
./bld compile pmdMain

Please check the PmdOperation documentation for all available configuration options.