Not to be confused with .pmd
|This article has multiple issues. Please help improve it or discuss these issues on the talk page.
||This article needs additional citations for verification. (August 2015)
PMD is a static rule-set 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 does not 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.
PMD is released under a BSDish license while parts of it are under Apache License 2.0 and the LGPL.
PMD includes a set of built-in rules and supports the ability to write custom rules. The custom rules can be written in two ways:
- Using XPath
- Using Java classes
Copy/Paste Detector (CPD)
The Copy/Paste Detector (CPD) is an add-on to PMD that uses the Rabin–Karp string search algorithm to find duplicated code. CPD works with Java, JSP, C, C++, Fortran, PHP, and C# code.
PMD has plugins for JDeveloper, Eclipse, jEdit, JBuilder, Omnicore's CodeGuide, NetBeans/Sun Studio, IntelliJ IDEA, TextPad, Maven, Ant, Gradle, Gel, JCreator, Hudson, Jenkins, SonarQube and Emacs.
- ^ a b "License". 18 January 2015. Retrieved 13 August 2015.