Table of Contents
💡 Overview
PMD is a static source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It’s mainly concerned with Java and Apex, but supports 16 other languages.
PMD features many built-in checks (in PMD lingo, rules), which are documented for each language in our Rule references. We also support an extensive API to write your own rules, which you can do either in Java or as a self-contained XPath query.
PMD is most useful when integrated into your build process. It can then be used as a quality gate, to enforce a coding standard for your codebase. Among other things, PMD can be run:
- As a Maven goal
- As an Ant task
- As a Gradle task
- As a bld operation
- From command-line
CPD, the copy-paste detector, is also distributed with PMD. You can also use it in a variety of ways, which are documented here.
💾 Download
The latest release of PMD can be downloaded from our Github releases page.
The Logo is available from the Logo Project Page.
📖 Documentation
The rest of this page exposes the contents of the documentation site thematically, which you can further scope down using the blue filter buttons. To navigate the site, you may also use the search bar in the top right, or the sidebar on the left.
✨ Contributors
This project follows the all-contributors specification. Contributions of any kind welcome!
See credits for the complete list.
<div class="card">
<div class="card-header text-center">
Getting started
</div>
<div class="card-body">
<p class="landing-page cat-description">
These pages summarize the gist of PMD usage to get you started quickly.
</p>
<ul>
<li><a href="pmd_userdocs_installation.html">Installation and basic CLI usage</a></li>
<li><a href="pmd_userdocs_making_rulesets.html">Making rulesets</a></li>
<li><a href="pmd_userdocs_configuring_rules.html">Configuring rules</a></li>
<li><a href="pmd_userdocs_extending_writing_rules_intro.html">Introduction to writing PMD rules</a></li>
</ul>
</div>
</div>
<div class="card">
<div class="card-header text-center">
<p class="fa-stack fa-5x">
<i class="fas fa-circle fa-stack-2x text-secondary"></i>
<i class="fas fa-database fa-stack-1x fa-inverse"></i>
</p>
</div>
<div class="card-header text-center">
Rule references
</div>
<div class="card-body">
<p class="landing-page cat-description">
Pick your language to find out about the rule it supports.
</p>
<ul>
<li><a href="pmd_userdocs_3rdpartyrulesets.html"></a></li>
<li><a href="pmd_rules_apex.html">Apex</a></li>
<li><a href="pmd_rules_html.html">HTML</a></li>
<li><a href="pmd_rules_java.html">Java</a></li>
<li><a href="pmd_rules_jsp.html">Java Server Pages</a></li>
<li><a href="pmd_rules_ecmascript.html">JavaScript</a></li>
<li><a href="pmd_rules_kotlin.html">Kotlin</a></li>
<li><a href="pmd_rules_pom.html">Maven POM</a></li>
<li><a href="pmd_rules_modelica.html">Modelica</a></li>
<li><a href="pmd_rules_plsql.html">PLSQL</a></li>
<li><a href="pmd_rules_visualforce.html">Salesforce Visualforce</a></li>
<li><a href="pmd_rules_scala.html">Scala</a></li>
<li><a href="pmd_rules_swift.html">Swift</a></li>
<li><a href="pmd_rules_velocity.html">Velocity Template Language (VTL)</a></li>
<li><a href="pmd_rules_xml.html">XML</a></li>
<li><a href="pmd_rules_xsl.html">XSL</a></li>
</ul>
</div>
</div>
<div class="card">
<div class="card-header text-center">
Writing rules
</div>
<div class="card-body">
<p class="landing-page cat-description">
These pages document the process of writing and testing custom rules and metrics for PMD.
</p>
<ul>
<li><a href="pmd_userdocs_extending_writing_rules_intro.html">Introduction to writing PMD rules</a></li>
<li><a href="pmd_userdocs_extending_your_first_rule.html">Your first rule</a></li>
<li><a href="pmd_userdocs_extending_writing_xpath_rules.html">Writing XPath rules</a></li>
<li><a href="pmd_userdocs_extending_writing_java_rules.html">Writing a custom rule</a></li>
<li><a href="pmd_userdocs_extending_designer_reference.html">The rule designer</a></li>
<li><a href="pmd_userdocs_extending_defining_properties.html">Defining rule properties</a></li>
<li><a href="pmd_userdocs_extending_rule_guidelines.html">Rule guidelines</a></li>
<li><a href="pmd_userdocs_extending_testing.html">Testing your rules</a></li>
<li><a href="pmd_userdocs_extending_writing_pmd_rules.html">Writing a custom rule</a></li>
</ul>
</div>
</div>
<div class="card">
<div class="card-header text-center">
<p class="fa-stack fa-5x">
<i class="fas fa-circle fa-stack-2x text-secondary"></i>
<i class="fas fa-cog fa-stack-1x fa-inverse"></i>
</p>
</div>
<div class="card-header text-center">
Usage and configuration
</div>
<div class="card-body">
<p class="landing-page cat-description">
Learn how to build effective and versatile rulesets.
</p>
<ul>
<li><a href="pmd_userdocs_migrating_to_pmd7.html">Migration Guide for PMD 7</a></li>
<li><a href="pmd_userdocs_installation.html">Installation and basic CLI usage</a></li>
<li><a href="pmd_userdocs_making_rulesets.html">Making rulesets</a></li>
<li><a href="pmd_userdocs_configuring_rules.html">Configuring rules</a></li>
<li><a href="pmd_userdocs_best_practices.html">Best Practices</a></li>
<li><a href="pmd_userdocs_suppressing_warnings.html">Suppressing warnings</a></li>
<li><a href="pmd_userdocs_incremental_analysis.html">Incremental Analysis</a></li>
<li><a href="pmd_userdocs_cli_reference.html">PMD CLI reference</a></li>
<li><a href="pmd_userdocs_report_formats.html">Report formats for PMD</a></li>
<li><a href="pmd_userdocs_3rdpartyrulesets.html">3rd party rulesets</a></li>
<li><a href="pmd_userdocs_cpd.html">Finding duplicated code with CPD</a></li>
<li><a href="pmd_userdocs_cpd_report_formats.html">Report formats for CPD</a></li>
<li><a href="pmd_userdocs_extending_ast_dump.html">Creating XML dump of the AST</a></li>
</ul>
</div>
</div>
<div class="card">
<div class="card-header text-center">
<p class="fa-stack fa-5x">
<i class="fas fa-circle fa-stack-2x text-secondary"></i>
<i class="fab fa-github fa-stack-1x fa-inverse"></i>
</p>
</div>
<div class="card-header text-center">
Contributing
</div>
<div class="card-body">
<p class="landing-page cat-description">
If you'd like to help us build PMD, these topics may interest you. See you around!
</p>
<ul>
<li><a href="pmd_devdocs_development.html">Developer Resources</a></li>
<li><a href="pmd_devdocs_building.html">Building PMD from source</a></li>
<li><a href="pmd_devdocs_writing_documentation.html">Writing documentation</a></li>
<li><a href="pmd_devdocs_roadmap.html">Roadmap</a></li>
<li><a href="pmd_devdocs_how_pmd_works.html">How PMD Works</a></li>
<li><a href="pmd_devdocs_pmdtester.html">Pmdtester</a></li>
<li><a href="pmd_devdocs_rule_deprecation_policy.html">Rule deprecation policy</a></li>
<li><a href="pmd_devdocs_logging.html">Logging</a></li>
</ul>
</div>
</div>
<div class="card">
<div class="card-header text-center">
Tools and integrations
</div>
<div class="card-body">
<p class="landing-page cat-description">
These pages describe solutions that integrate PMD within your build process.
</p>
<ul>
<li><a href="pmd_userdocs_tools_maven.html">Maven PMD Plugin</a></li>
<li><a href="pmd_userdocs_tools_gradle.html">Gradle</a></li>
<li><a href="pmd_userdocs_tools_ant.html">Ant Task Usage</a></li>
<li><a href="pmd_userdocs_tools_java_api.html">PMD Java API</a></li>
<li><a href="pmd_userdocs_tools_bld.html">bld PMD Extension</a></li>
<li><a href="pmd_userdocs_tools_ci.html">Continuous Integrations plugins</a></li>
<li><a href="pmd_userdocs_tools.html">Tools / Integrations</a></li>
</ul>
</div>
</div>
<div class="card">
<div class="card-header text-center">
Major contributions
</div>
<div class="card-body">
<p class="landing-page cat-description">
</p>
<ul>
<li><a href="pmd_devdocs_major_rule_guidelines.html">Guidelines for standard rules</a></li>
<li><a href="pmd_devdocs_major_adding_new_language_javacc.html">Adding PMD support for a new JavaCC grammar based language</a></li>
<li><a href="pmd_devdocs_major_adding_new_language_antlr.html">Adding PMD support for a new ANTLR grammar based language</a></li>
<li><a href="pmd_devdocs_major_adding_new_cpd_language.html">How to add a new CPD language</a></li>
</ul>
</div>
</div>
<!-- sizer -->
<div class="col-xs-6 col-sm-4 col-md-1 shuffle_sizer"></div>