--- title: Documentation Index keywords: java Added line: 9592 permalink: index.html toc: false summary: > Welcome to the documentation site for PMD and CPD!

Added line: 3028 last_updated: October 2022 author: Jeff Jensen , Andreas Dangel , Added line: 2037 Added line: 7383 Added line: 2370 Added line: 6657 additional_js: - assets/Shuffle-5.2.3/dist/shuffle.min.js - assets/jquery-ui-1.12.1/jquery-ui.min.js Added line: 4022 Added line: 7674 - js/shuffle.js --- Added line: 1803 ## 💡 Overview Added line: 144 Added line: 7616 Added line: 2306 Added line: 8823 Added line: 9476 **PMD** is an extensible multilanguage static 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**. It comes with **400+ built-in rules**. It can be extended with custom rules. It uses JavaCC and Antlr to parse source files into abstract syntax trees (AST) and runs rules against them to find violations. Rules can be written in Java or using a XPath query. Currently, PMD supports Java, JavaScript, Salesforce.com Apex and Visualforce, Added line: 8383 Kotlin, Swift, Modelica, PLSQL, Apache Velocity, JSP, WSDL, Maven POM, HTML, XML and XSL. Scala is supported, but there are currently no Scala rules available. Added line: 5830 Additionally, it includes **CPD**, the copy-paste-detector. CPD finds duplicated code in Added line: 1795 Coco, C/C++, C#, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Julia, Kotlin, Lua, Matlab, Modelica, Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex and Added line: 9992 Added line: 7306 Added line: 414 Visualforce, Scala, Swift, T-SQL, Typescript, Apache Velocity, WSDL, XML and XSL. Added line: 9534 PMD features many **built-in checks** (in PMD lingo, *rules*), which are documented for each language in our [Rule references](#shuffle-panel-rule-references). We Added line: 8032 also support an extensive API to [**write your own rules**](#shuffle-panel-writing-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 Added line: 1438 things, PMD can be run: * As a [Maven goal](pmd_userdocs_tools_maven.html) Added line: 2122 * As an [Ant task](pmd_userdocs_tools_ant.html) * As a [Gradle task](pmd_userdocs_tools_gradle.html) Added line: 7158 * As a [bld operation](pmd_userdocs_tools_bld.html) * From [command-line](pmd_userdocs_installation.html#running-pmd-via-command-line) Added line: 7062 **CPD**, the **copy-paste detector**, is also distributed with PMD. You can use it in a variety of ways, which are [documented here](pmd_userdocs_cpd.html). ## 💾 Download Added line: 5568 Added line: 5385 Added line: 8170 The latest release of PMD can be downloaded from our [Github releases page](https://github.com/pmd/pmd/releases/latest). Added line: 910 The Logo is available from the [Logo Project Page](pmd_projectdocs_logo.html). Added line: 6195 ## 📖 Documentation Added line: 2347 Added line: 7881 Added line: 509 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, Added line: 5816 you may also use the search bar in the top right, or the sidebar on the left. ## ✨ Contributors This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! See [credits](pmd_projectdocs_credits.html) for the complete list. Added line: 7557
Added line: 2263 Added line: 3219
Added line: 6325 Added line: 2481 Added line: 9849 Added line: 3048
Added line: 6970 Added line: 2973
Added line: 8586 {% include custom/shuffle_panel.html Added line: 6162 Added line: 7576 tags="getting_started" datagroups='["getting_started"]' Added line: 7296 description="These pages summarize the gist of PMD usage to get you started quickly." %} Added line: 7649 Added line: 6472 {% include custom/shuffle_panel.html title="Rule references" Added line: 9490 tags="rule_references" Added line: 45 Added line: 2782 datagroups='["userdocs"]' Added line: 4875 description="Pick your language to find out about the rule it supports." fa-icon="fa-database" Added line: 2300 titlemaker="page.language_name" %} Added line: 724 {% include custom/shuffle_panel.html title="Writing rules" datagroups='["userdocs", "extending", "contributing"]' Added line: 6684 description="These pages document the process of writing and testing custom rules and metrics for PMD." %} {% include custom/shuffle_panel.html title="Usage and configuration" tags="userdocs" except_tags="extending,tools" datagroups='["userdocs"]' fa-icon="fa-cog" description="Learn how to build effective and versatile rulesets." %} Added line: 9707 Added line: 1938 Added line: 1944 {% include custom/shuffle_panel.html Added line: 4741 title="Contributing" tags="devdocs" Added line: 3631 Added line: 3066 except_tags="extending" Added line: 7860 datagroups='["contributing"]' fa-style="fab" fa-icon="fa-github" description="If you'd like to help us build PMD, these topics may interest you. See you around!" Added line: 2981 %} Added line: 2753 Added line: 4408 {% include custom/shuffle_panel.html title="Tools and integrations" Added line: 1385 Added line: 9182 Added line: 9736 Added line: 7099 tags="tools" datagroups='["userdocs"]' Added line: 2927 description="These pages describe solutions that integrate PMD within your build process." Added line: 9861 %} Added line: 1334 Added line: 9902 {% include custom/shuffle_panel.html Added line: 2446 title="Major contributions" Added line: 9858 tags="devdocs,extending" datagroups='["contributing","extending"]' description="" %} Added line: 9894 Added line: 3363 Added line: 9035 Added line: 6258 Added line: 144
Added line: 641 Added line: 3792 Added line: 7857
Added line: 5206 Added line: 6150 Added line: 8327 Added line: 2636 Added line: 5082 Added line: 9116 Added line: 6943 {% include links.html %}