$ cd $HOME
$ wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.24.0/pmd-bin-6.24.0.zip
$ unzip pmd-bin-6.24.0.zip
$ alias pmd="$HOME/pmd-bin-6.24.0/bin/run.sh pmd"
$ pmd -d /usr/src -R rulesets/java/quickstart.xml -f text
$ cd $HOME
$ curl -OL https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.24.0/pmd-bin-6.24.0.zip
$ unzip pmd-bin-6.24.0.zip
$ alias pmd="$HOME/pmd-bin-6.24.0/bin/run.sh pmd"
$ pmd -d /usr/src -R rulesets/java/quickstart.xml -f text
C:\pmd-bin-6.24.0
C:\pmd-bin-6.24.0\bin
to PATH, eitherSET PATH=C:\pmd-bin-6.24.0;%PATH%
pmd.bat -d c:\src -R rulesets/java/quickstart.xml -f text
choco install -y pmd
pmd -d c:\src -R rulesets/java/quickstart.xml -f text
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, Salesforce.com 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 Salesforce.com Apex and Visualforce.
See How to contribute to PMD and How to build PMD.
Our license: BSD-style.
Source Code: Check it out on github