Reference articles on history, science, culture and more
Encyclopedia

Checkstyle

Java code analysis tool

Checkstyle is a static code analysis tool used in software development for checking if Java source code is compliant with specified coding rules.

Originally developed by Oliver Burn in 2001, the project is maintained by a team of developers from around the world.

The current stable release is version 13.0.0 which supports Java versions from 21.

01Advantages and limits

The programming style adopted by a software development project can help to ensure that the code is compliant with good programming practices which improve the quality, readability, and re-usability of the code and may reduce the cost of development. The checks performed by Checkstyle are mainly limited to the presentation of the code. These checks do not confirm the correctness or completeness of the code. Checkstyle rules are not programming style, they are merely rules for formatting the code.

02Examples of available modules

Checkstyle defines a set of available modules, each of which provides rules checking with a configurable level of strictness (mandatory, optional...). Each rule can raise notifications, warnings, and errors. For example, Checkstyle can examine the following:

  • Javadoc comments for classes, attributes and methods;
  • Naming conventions of attributes and methods;
  • The number of function parameters;
  • Line lengths;
  • The presence of mandatory headers;
  • The use of imports, and scope modifiers;
  • The spaces between some characters;
  • The practices of class construction;
  • Multiple complexity measurements.

03Usage

Checkstyle is available as a JAR file which can run inside a Java VM or as an Apache Ant task. It can also be integrated into an IDE or other tools.

Watch videos about CheckstyleExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article Checkstyle, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.