bld-pmd/README.md

1.4 KiB
Executable file

Bld Extension to Perform Static Code Analysis with PMD

License (3-Clause BSD) Java 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 code using a custom rule, java error prone rule and failing on any violation.

@BuildCommand
public void pmdMain() throws Exception {
    new PmdOperation
        .fromProject(this)
        .failOnValidation(true)
        .addInputPath(project.srcMainDirectory().toPath())
        .addRuletSet("config/pmd.xml", "category/java/errorprone.xml");
        .execute();
}
./dld compile pmdMain

Please check the PmdOperation documentation for all available configuration options.