2016-09-07 16:10:48 -04:00
|
|
|
---
|
2016-09-07 22:17:39 -04:00
|
|
|
title: PMD Introduction
|
|
|
|
keywords: java
|
2016-09-07 16:10:48 -04:00
|
|
|
tags: [getting_started]
|
|
|
|
permalink: index.html
|
2017-08-18 10:33:43 +02:00
|
|
|
toc: false
|
|
|
|
summary: >
|
|
|
|
Welcome to PMD, an extensible cross-language static code analyzer.
|
|
|
|
It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation,
|
|
|
|
and so forth. Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code.
|
|
|
|
last_updated: August 2017
|
2016-09-07 16:10:48 -04:00
|
|
|
---
|
|
|
|
|
2017-08-14 12:47:09 +02:00
|
|
|
{% include image.html file="pmd-logo-big.png" alt="PMD Logo" %}
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2017-08-18 10:33:43 +02:00
|
|
|
**PMD** scans source code in Java and other languages and looks for potential problems like:
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2016-09-07 22:17:39 -04:00
|
|
|
* Possible bugs - empty try/catch/finally/switch statements
|
|
|
|
* Dead code - unused local variables, parameters and private methods
|
|
|
|
* Suboptimal code - wasteful String/StringBuffer usage
|
|
|
|
* Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2017-08-18 10:33:43 +02:00
|
|
|
**CPD**, the copy-pase-detector, finds duplicated code in many languages:
|
|
|
|
|
|
|
|
* Duplicate code is often just copied and pasted. This means, the bugs are also copied and pasted. Fixing
|
|
|
|
them means, fix all duplicated code locations.
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
{::options parse_block_html="true" /}
|
|
|
|
|
|
|
|
<div class="row"><div class="col-lg-6">
|
|
|
|
### PMD
|
|
|
|
|
|
|
|
Features:
|
|
|
|
|
|
|
|
* Supporting 8 languages
|
|
|
|
* Many ready-to-use built-in rules.
|
|
|
|
* Custom rules can be written in Java
|
|
|
|
* Custom rules can be written using XPath expression that query the AST of the sources
|
|
|
|
* Many output formats
|
|
|
|
* Many integrations into IDEs, build tools
|
|
|
|
|
|
|
|
Supported Languages:
|
|
|
|
|
|
|
|
* [Java](pmd_rules_java.html)
|
|
|
|
* [JavaScript](pmd_rules_ecmascript.html)
|
|
|
|
* [Salesforce.com Apex](pmd_rules_apex.html) and [Visualforce](pmd_rules_vf.html)
|
|
|
|
* [PLSQL](pmd_rules_plsql.html)
|
|
|
|
* [Apache Velocity](pmd_rules_vm.html)
|
|
|
|
* [XML](pmd_rules_xml.html) and [Maven POM](pmd_rules_pom.html)
|
|
|
|
* [XSL](pmd_rules_xsl.html)
|
|
|
|
|
|
|
|
</div><div class="col-lg-6">
|
|
|
|
### CPD
|
|
|
|
|
|
|
|
Features:
|
|
|
|
|
|
|
|
* Supporting 19 languages
|
|
|
|
* Simple GUI
|
|
|
|
* Fast
|
|
|
|
* Many integrations
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2017-08-18 10:33:43 +02:00
|
|
|
Supported Languages:
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2017-08-18 10:33:43 +02:00
|
|
|
* Java
|
|
|
|
* C, C++
|
|
|
|
* C#
|
|
|
|
* Groovy
|
|
|
|
* PHP
|
|
|
|
* Ruby
|
|
|
|
* Fortran
|
|
|
|
* JavaScript
|
|
|
|
* PLSQL
|
|
|
|
* Apache Velocity
|
|
|
|
* Scala
|
|
|
|
* Objective C
|
|
|
|
* Matlab
|
|
|
|
* Python
|
|
|
|
* Go
|
|
|
|
* Swift
|
|
|
|
* Salesforce.com Apex and Visualforce
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2017-08-18 10:33:43 +02:00
|
|
|
</div></div>
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2017-08-18 10:33:43 +02:00
|
|
|
## Download PMD {{ site.pmd.version }}
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2017-08-18 10:33:43 +02:00
|
|
|
Latest Version: {{ site.pmd.version }} ({{ site.pmd.date }})
|
2016-09-07 16:10:48 -04:00
|
|
|
|
2017-08-18 10:33:43 +02:00
|
|
|
* [Release Notes](pmd_release_notes.html)
|
|
|
|
* [Download](https://github.com/pmd/pmd/releases)
|
2016-09-07 16:10:48 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% include links.html %}
|