##### Overview

- Download PMD 5.0.4
- What's new in PMD 5.0.4
- 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

## Braces

The Braces Ruleset contains a collection of braces rules.

### IfStmtsMustUseBraces

Since: PMD 5.0

Avoid using if statements without using curly braces.

    //IfStatement[@Else = "false" and not(child::Scope)]

Example(s):

    // Ok
    if (foo) {
       x++;
    }

    // Bad
    if (foo)
       x++;

### IfElseStmtsMustUseBraces

Since: PMD 5.0

Avoid using if..else statements without using curly braces.

    //ExpressionStatement[parent::IfStatement[@Else = "true"]]
       [not(child::Scope)]
       [not(child::IfStatement)]

Example(s):

    // Ok
    if (foo) {
       x++;
    } else {
       y++;
    }

    // Bad
    if (foo)
       x++;
    else
       y++;

### WhileLoopsMustUseBraces

Since: PMD 5.0

Avoid using 'while' statements without using curly braces.

    //WhileLoop[not(child::Scope)]

Example(s):

    // Ok
    while (true) {
       x++;
    }

    // Bad
    while (true)
       x++;

### ForLoopsMustUseBraces

Since: PMD 5.0

Avoid using 'for' statements without using curly braces.

    	//ForLoop[not(child::Scope)]
    |
    	//ForInLoop[not(child::Scope)]

Example(s):

    // Ok
    for (var i = 0; i < 42; i++) {
       foo();
    }

    // Bad
    for (var i = 0; i < 42; i++)
       foo();