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 comment (computer programming), comments, written using a human-readable programming language, usually as plain text. The source code of a Computer program, p ...
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. Autoa ...
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 mo ...
,
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 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 ...
, 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 that is given ''local scope''. A local variable reference in the function or block in which it is declared overrides the same variable name in the larger scope. In programming languages with o ...
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.


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++, Fortran,
PHP PHP is a General-purpose programming language, 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 implementati ...
, and C# code.


Plugins

PMD has
plugins Plug-in, plug in or plugin may refer to: * Plug-in (computing) is a software component that adds a specific feature to an existing computer program. ** Audio plug-in, adds audio signal processing features ** Photoshop plugin, a piece of software t ...
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 Embarcad ...
, Omnicore's CodeGuide,
NetBeans NetBeans is an integrated development environment (IDE) for Java. NetBeans allows applications to be developed from a set of modular software components called ''modules''. NetBeans runs on Windows, macOS, Linux and Solaris. In addition to Java ...
/
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 for developing computer software written in Java, Kotlin, Groovy, and other JVM-based languages. It is developed by JetBrains (formerly known as IntelliJ) and is a ...
, TextPad,
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,0 ...
,
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, Jenkins,
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 compl ...
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, ...
. There is also a CLI 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, Mirror site ...
. * 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