Checkstyle

Checkstyle

Language: Java
Checks: 164
Categories: Style
Checkstyle Version: 8.39 (version 9.2 available using beta channel)

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.

Enable the Plugin

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

plugins:
  checkstyle:
    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 file: codeclimate_checkstyle.xml . More configuration documentation is available from Checkstyle's documentation here.

To use your own configurations:

  1. Add this configuration to your .codeclimate.yml:
plugins:
  checkstyle:
    enabled: true
    config:
      file: "checkstyle.xml"
  1. And set the default Severity to warning, as shown in the checkstyle.xml example here:
...
<module name="Checker">
    <property name="severity" value="warning"/>
    ...

Enabling Checkstyle's newer version

A newer version of Checkstyle (version 9.2) can be used by enabling the beta channel.

plugins:
  checkstyle:
    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: http://checkstyle.sourceforge.net/.