PMD - Don't shoot the messenger


An extensible cross-language static code analyzer.

Latest Version: 5.8.1 (1st July 2017)
Release Notes | Download | Documentation


See Installation and Command Line Usage
$ cd $HOME
$ wget
$ unzip
$ alias pmd="$HOME/pmd-bin-5.8.1/bin/ pmd"
$ pmd -d /usr/src -R java-basic -f text
$ cd $HOME
$ curl -OL
$ unzip
$ alias pmd="$HOME/pmd-bin-5.8.1/bin/ pmd"
$ pmd -d /usr/src -R java-basic -f text
  1. Download
  2. Extract the zip-archive, e.g. to C:\pmd-bin-5.8.1
  3. Add folder C:\pmd-bin-5.8.1\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-5.8.1;%PATH%
  4. Execute at command line: pmd.bat -d c:\src -R java-basic -f text
Checkout the existing rules.

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.