PMD (software)
   HOME

TheInfoList



OR:

PMD is an open source static
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
analyzer An analyser or analyzer is a tool used to analyze data. For example, a gas analyzer tool is used to analyze gases. It examines the given data and tries to find patterns and relationships. An analyser can be a piece of hardware or software. Autoan ...
that reports on issues found within application code. PMD includes built-in rule sets and supports the ability to write custom rules. PMD does not report compilation errors, as it only can process well-formed source files. Issues reported by PMD are rather inefficient code, or bad programming habits, which can reduce the performance and maintainability of the program if they accumulate. It can analyze files written in
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
,
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
,
Apex The apex is the highest point of something. The word may also refer to: Arts and media Fictional entities * Apex (comics), a teenaged super villainess in the Marvel Universe * Ape-X, a super-intelligent ape in the Squadron Supreme universe *Apex ...
and Visualforce, PLSQL,
Apache Velocity Apache Velocity first released in April 2001, is a Java-based template engine that provides a template language to reference objects defined in Java code. It aims to ensure clean separation between the presentation tier and business tiers in a W ...
, XML, and XSL. While PMD does not officially stand for anything, several retroacronyms have been suggested, including for instance ''Programming Mistake Detector'' and ''Project Meets Deadline''.


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 variable In computer science, a local variable is a Variable (programming), variable that is given ''local scope (programming), scope''. A local variable reference in the subroutine, function or block (programming), block in which it is declared overrides ...
s,
parameter A parameter (), generally, is any characteristic that can help in defining or classifying a particular system (meaning an event, project, object, situation, etc.). That is, a parameter is an element of a system that is useful, or critical, when ...
s 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 Cyclomatic complexity is a software metric used to indicate the complexity of a program. It is a quantitative measure of the number of linearly independent paths through a program's source code. It was developed by Thomas J. McCabe, Sr. in 1976 ...
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 The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
.


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. Unlike PMD, CPD works with a broader range of languages including Java,
JavaServer Pages Jakarta Server Pages (JSP; formerly JavaServer Pages) is a collection of technologies that helps software developers create dynamically generated web pages based on HTML, XML, SOAP, or other document types. Released in 1999 by Sun Microsystems, J ...
(JSP), C,
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, Fortran,
PHP PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by The PHP Group ...
, and C# code.


Plugins

PMD has plugins for
JDeveloper JDeveloper is a freeware IDE supplied by Oracle Corporation. It offers features for development in Java, XML, SQL and PL/SQL, HTML, JavaScript, BPEL and PHP. JDeveloper covers the full development lifecycle from design through coding, debugging ...
,
Eclipse An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three ce ...
, jEdit,
JBuilder JBuilder is a discontinued integrated development environment (IDE) for the programming language Java from Embarcadero Technologies. Originally developed by Borland, JBuilder was spun off with CodeGear which was eventually purchased by Embarcader ...
, Omnicore's CodeGuide,
NetBeans NetBeans is an integrated development environment (IDE) for Java (programming language), Java. NetBeans allows applications to be developed from a set of modular software components called ''modules''. NetBeans runs on Microsoft Windows, Windows, ...
/
Sun Studio Sun Studio is a recording studio opened by rock-and-roll pioneer Sam Phillips at 706 Union Avenue in Memphis, Tennessee, on January 3, 1950. It was originally called Memphis Recording Service, sharing the same building with the Sun Records label ...
,
IntelliJ IDEA IntelliJ IDEA is an integrated development environment (IDE) written in Java (programming language), Java for developing computer software written in Java, Kotlin (programming language), Kotlin, Groovy (programming language), Groovy, and other ...
,
TextPad TextPad is a text editor for Microsoft Windows developed by Helios Software Solutions. It is currently in its eighth major version. TextPad was initially released in 1992 as shareware, with users requested to pay a registration fee to support ...
,
Maven MAVEN is an American spacecraft orbiting Mars to study the loss of its atmospheric gases to space, providing insight into the history of the planet's climate and water. The spacecraft name is an acronym for "Mars Atmosphere and Volatile Evolu ...
,
Ant Ants are eusocial insects of the family Formicidae and, along with the related wasps and bees, belong to the order Hymenoptera. Ants evolved from vespoid wasp ancestors in the Cretaceous period. More than 13,800 of an estimated total of 22 ...
,
Gradle Gradle is a build automation tool for multi-language software development. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing. Supported languages include Java (as well as Kotli ...
, Gel, JCreator,
Hudson Hudson may refer to: People * Hudson (given name) * Hudson (surname) * Henry Hudson, English explorer * Hudson (footballer, born 1986), Hudson Fernando Tobias de Carvalho, Brazilian football right-back * Hudson (footballer, born 1988), Hudso ...
,
Jenkins Jenkins may refer to: People * Jenkins (name), history of the surname * List of people with surname Jenkins * The Jenkins, country music group Places United States *Jenkins, Illinois *Jenkins, Kentucky *Jenkins, Minnesota *Jenkins, Missouri *Je ...
,
SonarQube SonarQube (formerly Sonar) is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs and code smells on 29 programming languages. S ...
,
Visual Studio Code Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made by Microsoft with the Electron Framework, for Windows, Linux and macOS. Features include support for debugging, syntax highlighting, intelligent code complet ...
and
Emacs Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, s ...
. There is also a
CLI CLI may refer to: Computing * Call Level Interface, an SQL database management API * Command-line interface, of a computer program * Command-line interpreter or command language interpreter; see List of command-line interpreters * CLI (x86 instruc ...
version.


See also

*
List of tools for static code analysis This is a list of notable tools for static program analysis (program analysis is a synonym for code analysis). Static code analysis tools Languages Ada * * * * * * * * * * * C, C++ * * * * * * * * * * * * ...
*
SonarQube SonarQube (formerly Sonar) is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs and code smells on 29 programming languages. S ...


References


Further reading

* Rutar, Almazan, Foster (2004)
"A Comparison of Bug Finding Tools for Java"
''ISSRE '04 Proceedings of the 15th International Symposium on Software Reliability Engineering'', IEEE, DOI
10.1109/ISSRE.2004.1


External links

* * * * on
SourceForge.net SourceForge is a web service that offers software consumers a centralized online location to control and manage open-source software projects and research business software. It provides source code repository hosting, bug tracking, mirroring ...
. * Written by the lead developer, Tom Copeland

. * {{URL, http://www.javavillage.in/PMD-CPD-in-maven.php, PMD and CPD in Maven Java development tools Static program analysis tools Free software testing tools