Overview

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.

Checkstyle is highly configurable and can be made to support almost any coding standard. An example configuration file is supplied supporting the Sun Code Conventions. As well, other sample configuration files are supplied for other well known conventions.

A good example of a report that can be produced using Checkstyle and Maven can be seen here.

Important Development Changes

As of September 2013, the Checkstyle project is using GitHub for hosting the following:

  • Source code repository - replacing the Mercurial repository on SourceForge.
  • Issue management - replacing the Bugs/Feature/Patches on SourceForge. All new issues should be raised at GitHub, and pull requests are now the preferred way to submit patches.

SourceForge will still be used for website hosting, binary downloads and mailing lists.

These changes are being made to breathe new life into the development of Checkstyle. The following developers have been added as committers of the Checkstyle project:

Features

Checkstyle can check many aspects of your source code. Historically its main functionality has been to check code layout issues, but since the internal architecture was changed in version 3, more and more checks for other purposes have been added. Now Checkstyle provides checks that find class design problems, duplicate code, or bug patterns like double checked locking.

For a detailed list of available checks please refer to the Standard Checks page.

Download

The latest release of Checkstyle can be downloaded from the SourceForge download page.

If you want to live on the bleeding edge, you can checkout the current development code from GitHub and compile yourself.

Related Tools

Checkstyle is most useful if you integrate it in your build process or your development environment. The distribution includes:

  • An Ant task.
  • A command line tool.

Additionally plug-ins are written by third-parties. Some of them are still based on the Checkstyle 2.4 release, although there have been many improvements since then. The known plug-ins are:

IDE / Build tool Main/Initial Author Available from Remarks
SCM-Manager SCM-Manager Plugin Page
jGRASP Larry Barowski jGRASP Home Page
Sonar Freddy Mallet (initial author) Sonar Home Page Demo site
Eclipse/RAD/RDz David Schneider Eclipse-CS Home Page In 2007 was awarded Best Open Source Eclipse-based Developer tool .
Eclipse/RAD/RDz Roman Ivanov Project Page Extension for Eclipse-CS plugin and also an incubator for Checkstyle checks that are not present in main stream of Checkstyle. See the Wiki and Blog .
Eclipse/RAD/RDz Marco van Meegen Checklipse Home Page
IntelliJ IDEA Jakub Slawinski QAPlug Provides quality assurance features.
IntelliJ IDEA James Shiell Checkstyle-idea Project Page Provides real-time and on-demand scanning.
IntelliJ IDEA Mark Lussier JetStyle Project Page
NetBeans Petr Hejl Checkstyle Beans Problems with source code are displayed as annotations of the source
NetBeans Paul Goulbourn nbCheckStyle
NetBeans Software Quality Environment (SQE)
jCoderZ fawkeZ Combines multiple tools (CheckStyle, findbugs, PMD, Cobertura, etc.)
BlueJ Rick Giles bluejcheckstyle home page
tIDE Built in
Emacs JDE Markus Mohnen Part of the standard JDEE distribution
jEdit Todd Papaioannou JEdit CheckStylePlugin
Vim editor Xandy Johnson Plugin Homepage Vim file-type plug-in
Maven Vincent Massol Checkstyle supported out of the box example report
QALab Benoit Xhenseval QALab Home Page Supports tracking Checkstyle statistics over time.

If you have written a plugin for other IDEs, please let us know, so we can provide a link here.