##### Overview

- Download PMD 5.0.5
- What's new in PMD 5.0.5
- PMD in the news
- PMD-related products and books
- Best practices
- Future directions
- Similar projects
- Credits
- License
- What does 'PMD' mean?

##### Usage

- Installation
- Command line usage
- Ant task usage
- Maven plugin usage
- Mvn plugin usage
- IDE plugin usage
- Suppressing warnings
- Finding duplicated code
- JSP support

##### Customizing PMD

- Compiling PMD
- How to write a rule
- Writing XPath rules
- How to make a rule set
- How it works
- Rule guidelines
- PMD developers information
- PMD Release Process

##### For example

- Run PMD on a Sourceforge project

##### Misc.

- XPath tutorial (Gregorian)

##### Rule Sets

- ecmascript
  - Basic Ecmascript
  - Braces
  - Unnecessary
- java
  - Android
  - Basic
  - Braces
  - Clone Implementation
  - Code Size
  - Comments
  - Controversial
  - Coupling
  - Design
  - Empty Code
  - Finalizer
  - Import Statements
  - J2EE
  - JavaBeans
  - JUnit
  - Jakarta Commons Logging
  - Java Logging
  - Migration
  - Naming
  - Optimization
  - Strict Exceptions
  - String and StringBuffer
  - Security Code Guidelines
  - Type Resolution
  - Unnecessary
  - Unused Code
- jsp
  - Basic JSF
  - Basic JSP
- xml
  - Basic XML
- xsl
  - XPath in XSL

##### Project Documentation

- Project Information
- Project Reports

## Frequently Asked Questions

Development

1. In which order are nodes visited?
2. Is there a simple way of getting fields from a given class?

Rules

1. How useful are the rules?

## Development

In which order are nodes visited?

  The parser performs a depth-first traversal. Consider the given source:

      public class Foo {
      String name;
          private class Bar {
          String x;
          }
      int total;
      }

  The visiting order here will be:

  1. Class Foo
  2. Field name
  3. Class Bar
  4. Field x
  5. Field total

  Note that the total field of Foo will be visited after visiting the fields in Bar. You must take this into account for certain rules.

  [top]

Is there a simple way of getting fields from a given class?

  Yes, the symbol table can supply that information.

  FIXME add code example

  [top]

## Rules

How useful are the rules?

  Have this clear: having a projects with no pmd violations does not mean at all, I repeat, It does not mean at all, not at the minimum expected, that the project has any quality. For illustrating this I'll tell a little story taken from my work (a sadly real story). Some classes had fields that were reported as unused, (unused code ruleset) as developers saw this, they wanted to remove the violation, (not fix the code, fix the violation) so the action took was to add useless log sentences with something like: 'unused variable '+unusedVariable. Belive it or not, the code was worse than the original and reported less pmd violations.

  In a more positive way: use the rules as you see them fix, don't try to remove violations per-se try to review the code and see if the particular cases you are using are correct or not.

  [top]