Checkstyle

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Checkstyle
Checkstyle Logo.png
Stable release
8.45 / July 31, 2021; 13 months ago (2021-07-31)
Repository
Written inJava
Operating systemCross-platform
TypeStatic code analysis
LicenseLesser GNU General Public License
Websitecheckstyle.sourceforge.net Edit this at Wikidata

Checkstyle[1] 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 back in 2001, the project is maintained by a team of developers from around the world.

The current stable release is version 8.45[2] which is targeted at the Java 8 language.

Advantages and limits[edit]

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, 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.

Chceckstyle rules are not programming style, they are merely rules for formatting the code. These are just restrictions taking away freedom of structuring the code because someone invented enforcing strict rules in formatting the code believing that it would be better for programmers for some productivity reasons, no evidence support these claim nor serious studies were conducted to exmine the thesis.

Examples of available modules[edit]

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.

Usage[edit]

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. When Checkstyle errors are found, it is possible to use tools to automatically fix them, such as WalkMod[3] or Styler.[4]

See also[edit]

References[edit]

  1. ^ "Checkstyle Home Page". 2010. Retrieved 2010-11-02.
  2. ^ "checkstyle - Release Notes". 2021. Retrieved 2021-08-05.
  3. ^ "WalkMod". walkmod.com. Retrieved 2022-08-24.
  4. ^ Loriot, Benjamin; Madeiral, Fernanda; Monperrus, Martin (2022-08-06). "Styler: learning formatting conventions to repair Checkstyle violations". Empirical Software Engineering. 27 (6): 149. doi:10.1007/s10664-021-10107-0. ISSN 1573-7616.

External links[edit]