PMD - Don't shoot the messenger


An extensible cross-language static code analyzer.

Latest Version: 6.53.0 (31-December-2022)
Release Notes | Source


See also Getting Started
$ cd $HOME
$ wget
$ unzip
$ alias pmd="$HOME/pmd-bin-6.53.0/bin/ pmd"
$ pmd -d /usr/src -R rulesets/java/quickstart.xml -f text
$ cd $HOME
$ curl -OL
$ unzip
$ alias pmd="$HOME/pmd-bin-6.53.0/bin/ pmd"
$ pmd -d /usr/src -R rulesets/java/quickstart.xml -f text
  1. Download
  2. Extract the zip-archive, e.g. to C:\pmd-bin-6.53.0
  3. Add folder C:\pmd-bin-6.53.0\bin to PATH, either
    1. Permanently: Using System Properties dialog > Environment variables > Append to PATH variable
    2. Temporarily, at command line: SET PATH=C:\pmd-bin-6.53.0\bin;%PATH%
  4. Execute at command line: pmd.bat -d c:\src -R rulesets/java/quickstart.xml -f text
  1. Install Chocolatey, if you don't already have it!
  2. Install PMD: choco install -y pmd
  3. Run from the command-line! pmd -d c:\src -R rulesets/java/quickstart.xml -f text
Checkout the existing rules for Java.

About PMD

PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It supports Java, JavaScript, Apex and Visualforce, PLSQL, Apache Velocity, XML, XSL.

Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in Java, C, C++, C#, Groovy, PHP, Ruby, Fortran, JavaScript, PLSQL, Apache Velocity, Scala, Objective C, Matlab, Python, Go, Swift and Apex and Visualforce.


Need help?

Get Involved

See How to contribute to PMD and How to build PMD.

Our license: BSD-style.

Source Code: Check it out on github