bld-pmd/README.md
2023-08-10 22:27:45 -07:00

1.8 KiB
Executable file

Bld Extension to Perform Static Code Analysis with PMD

License Java Release Snapshot GitHub CI

To check all source code using the java quickstart rule.

@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.