PMD
From http://pmd.sourceforge.net/
PMD scans Java source code and looks for potential problems like:
- Possible bugs - empty try/catch/finally/switch statements
- Dead code - unused local variables, parameters and private methods
- Suboptimal code - wasteful String/StringBuffer usage
- Oercomplicated expressions - unnecessary if statements, for loops that could be while loops
- Duplicate code - copied/pasted code means copied/pasted bugs
CPD
From http://pmd.sourceforge.net/cpd.html
Duplicate code can be hard to find, especially in a large project. But PMD's Copy/Paste Detector (CPD) can find it for you! CPD has been through three major incarnations:
- First we wrote it using a variant of Michael Wise's Greedy String Tiling algorithm (our variant is described here)
- Then it was completely rewritten by Brian Ewins using the Burrows-Wheeler transform
- Finally, it was rewritten by Steve Hawkins to use the Karp-Rabin string matching algorithm