Checkstyle¶
checkstyle is a static analysis tool that provides a variety of checkers for Java code and documentation.
Supported File Types¶
The following are supported by this tool:
Java:
*.java
Installation¶
To install checkstyle, download the latest checkstyle.jar file and place it somewhere on your system.
We recommend choosing a common path for your Review Bot .jar
files.
Make note of the location. You’ll be configuring it below.
Configuration¶
Checkstyle Location¶
First, make sure you have java in your path, or specified in exe_paths. For example:
exe_paths = {
'java': ['/path/to/java'],
}
You’ll then need to specify the path
to the downloaded checkstyle.jar
file in the Review Bot worker
config file:
java_classpaths = {
'checkstyle': ['/path/to/checkstyle.jar'],
}
You will need to restart the Review Bot worker after making this change.
Enabling Checkstyle in Review Board¶
First, you’ll need to add a Review Bot configuration in Review Board (see Tool Configurations).
The following configuration options are available:
- Configuration XML (required):
You’ll need to provide either:
The name of an existing Checkstyle-provided XML configuration (such as
google_checks.xml
orsun_checks.xml
)The full contents of a custom configuration XML file (see the XML configuration documentation for details)