PMD (software)
From Wikipedia, the free encyclopedia
| This article or section needs sources or references that appear in reliable, third-party publications. Primary sources and sources affiliated with the subject of the article are generally not sufficient for a Wikipedia article. Please include more appropriate citations from reliable sources, or discuss the issue on the talk page. This article has been tagged since April 2007. |
PMD is a static ruleset based Java source code analyzer that identifies potential problems like:
- Possible bugs - Empty try/catch/finally/switch blocks.
- Dead code - Unused local variables, parameters and private methods
- Empty if/while statements
- Overcomplicated expressions - Unnecessary if statements, for loops that could be while loops
- Suboptimal code - wasteful String/StringBuffer usage
- Classes with high Cyclomatic Complexity measurements.
- Duplicate code - Copied/pasted code can mean copied/pasted bugs, and decreases maintainability.
While PMD doesn't officially stand for anything, it has several unofficial names, the most appropriate probably being Programming Mistake Detector.
Typically, PMD errors are not true errors, but rather inefficient code, i.e. the application could still function properly even if they were not corrected.
Contents |
[edit] Rulesets
PMD includes a set of builtin rules and supports the ability to write custom rules.
[edit] Copy/Paste Detector (CPD)
The Copy/Paste Detector (CPD) is an add-on to PMD that uses the Karp-Rabin string matching algorithm to find duplicated code. CPD works with Java, C, C++, and PHP code.
[edit] Plugins
PMD has plugins for JDeveloper, Eclipse, JEdit, JBuilder, Omnicore's CodeGuide, NetBeans/Sun ONE Studio, IntelliJ IDEA, TextPad, Maven, Ant, Gel, JCreator, and Emacs.
[edit] External links
- Book: "PMD Applied". Written by the lead developer, Tom Copeland (http://tomcopeland.blogs.com/).

