Finds common flaws such as unused variables and empty catch blocks across many languages, with hundreds of built-in rules plus custom rules.
Overview
PMD scans source for likely bugs and maintainability problems. It focuses on Java and Salesforce Apex but includes analyzers for many other languages, parsing sources into ASTs and applying built-in or custom rules written in Java or XPath.
Users run the pmd check command from a downloaded binary distribution or package installs on Linux, macOS, and Windows. Quickstart rulesets help new adopters; Maven, Gradle, and IDE plugins integrate the tool into builds and editors.
The distribution also bundles CPD, the copy-paste detector, which flags duplicated text across a long list of programming and markup languages. Violations can be reported as text, XML, JSON, and other formats for CI systems.
Teams extend PMD with project-specific rules and wire it into quality gates. Commercial support is available from third parties; community channels handle questions and bug reports.
Key features
- 400+ built-in analysis rules
- Custom rules in Java or XPath
- Multi-language parsers via JavaCC and ANTLR
- CPD duplicate-code detection
- CLI check command
- Maven and Gradle plugins
- IDE integrations
- Multiple report formats
Use cases
- Java and Apex quality gates
- Finding dead and unused code
- Detecting copy-paste duplication
- CI static analysis pipelines
- Enforcing team coding rules