Optional Checks - Version 3.4

Checkstyle Logo

Overview

Core Checkstyle Checks are applicable to general Java coding style and require no external libraries. An optional Check is for special applications or requires additional libraries. There are are optional Checks for:

Configuration

As with core Checks, optional Checks are configured as submodules of TreeWalker. The shortened name of an optional Check module must include the appropriate package name prefix. For example, this is a configuration fragment for Check com.puppycrawl.tools.checkstyle.checks.usage.UnusedLocalVariable:

<module name="usage.UnusedLocalVariable"/>

Consult the Checkstyle configuration manual to learn how to integrate optional Checks into the package configuration so that you can use fully shortened names such as UnusedLocalVariable.

Usage

Optional checks are distributed in jar file checkstyle-optional-3.4.jar and, in order to use an optional check, this jar file must be in the classpath. For example, this is a command to run Checkstyle with a configuration that contains optional checks:

java -classpath checkstyle-optional-3.4.jar:checkstyle-all-3.4.jar \
    com.puppycrawl.tools.checkstyle.Main \
    -c config.xml -r .

Please consult Command Line and ANT Task documentation for further usage information.


Back to the Checkstyle Home Page