# Documentation Index

Welcome to the documentation site for PMD and CPD!
Edit me

## 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 six 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
- 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.

## 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.

Getting started

These pages summarize the gist of PMD usage to get you started quickly.

- Installation and basic CLI usage
- Making rulesets
- Configuring rules
- Introduction to writing PMD rules

Rule references

Pick your language to find out about the rule it supports.

- Apex
- Ecmascript
- Java
- Java Server Pages
- Maven POM
- Modelica
- PLSQL
- Salesforce VisualForce
- VM
- XML
- XSL
- Scala

Writing rules

These pages document the process of writing and testing custom rules and metrics for PMD.

- Introduction to writing PMD rules
- Your first rule XPath
- Writing XPath rules
- Writing a custom rule
- The rule designer
- Defining rule properties
- Using and defining code metrics for custom rules
- Rule guidelines
- Testing your rules
- Writing a custom rule

Usage and configuration

Learn how to build effective and versatile rulesets.

- Installation and basic CLI usage
- Making rulesets
- Configuring rules
- Best Practices
- Suppressing warnings
- Incremental Analysis
- PMD CLI reference
- Report formats for PMD
- Finding duplicated code with CPD
- Report formats for CPD

Contributing

If you'd like to help us build PMD, these topics may interest you. See you around!

- Developer Resources
- Building PMD from source
- Writing documentation
- Roadmap
- How PMD Works
- Pmdtester
- Rule deprecation policy
- Creating XML dump of the AST

Tools and integrations

These pages describe solutions that integrate PMD within your build process.

- Maven PMD Plugin
- Gradle
- Ant Task Usage
- PMD Java API
- Continuous Integrations plugins
- Tools / Integrations

Major contributions

- Adding PMD support for a new language
- How to add a new CPD language
- Adding support for metrics to a language