Language: Java
Checks: 23
Categories: Style
PMD Version: 6.7.0 (6.40.0 available using beta channel)

PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, etc.

Enable the Plugin

To enable PMD analysis, add the following to your .codeclimate.yml configuration file:

plugins:
  pmd:
    enabled: true

More information about the CLI is available in the README here: https://github.com/codeclimate/codeclimate

Configure the Plugin

This engine ships with the following configuration: https://pmd.github.io/pmd-5.8.1/pmd-java/rules/index.html#Basic - you are highly encouraged to use your own! More configuration documentation is available here: https://pmd.github.io/pmd-5.8.1/pmd-java/rules/index.html
If the file ruleset.xml is present in the root directory of the project, it is used as the default ruleset without extra configuration.

Custom rules

plugins:
  pmd:
    enabled: true
    config:
      file: pmd-rules.xml

Rule names

Alternatively, you can specify a list of rule names, instead of a ruleset.xml file:

plugins:
  pmd:
    enabled: true
    config:
      rules:
        - "java-basic"
        - "java-design"
        - "java-android"

Enabling PMD's newer version

A newer version of PMD (version 6.40.0) can be used by enabling the beta channel.

plugins:
  pmd:
    enabled: true
    channel: "beta"

Understand the Plugin

For more information about all the checks available and their configuration options, please check out the documentation here: https://pmd.github.io/