Jump to content

PMD (software)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 2001:a61:302d:4b01:c682:6f19:6717:36b5 (talk) at 17:22, 20 November 2016. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

PMD
Stable release
5.5.2 / 5 November 2016; 8 years ago (2016-11-05)
Repository
Written inJava
Operating systemWindows, Linux, OS X
TypeStatic program analysis tool
LicenseBSD License, Apache License 2.0, GNU Lesser General Public License[1]
Websitepmd.github.io Edit this on Wikidata

PMD is a static Java source code analyzer. It uses rule-sets to define when a piece of source is erroneous. PMD includes a set of built-in rules and supports the ability to write custom rules. Typically, issues reported by PMD are not true errors, but rather inefficient code, i.e. the application could still function properly even if they were not corrected.

While PMD does not officially stand for anything, it has several unofficial names, the most appropriate probably being Programming Mistake Detector.

Features

PMD is able to detect flaws or possible flaws in source code, 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.

License

PMD is released under a BSDish license while parts of it are under Apache License 2.0 and the LGPL.[1]

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.

Plugins

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.

See also

References

  1. ^ a b "License". 18 January 2015. Retrieved 13 August 2015.