HOME

TheInfoList



OR:

Checkstyle is a
static code analysis In computer science, static program analysis (or static analysis) is the analysis of computer programs performed without executing them, in contrast with dynamic program analysis, which is performed on programs during their execution. The term ...
tool used in
software development Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications, frameworks, or other software components. Software development inv ...
for checking if
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
source code In computing, source code, or simply code, is any collection of code, with or without comment (computer programming), comments, written using a human-readable programming language, usually as plain text. The source code of a Computer program, p ...
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 10.5.0 which supports Java versions from 11 to 17.


Advantages and limits

The
programming style Programming style, also known as code style, is a set of rules or guidelines used when writing the source code for a computer program. It is often claimed that following a particular programming style will help programmers read and understand sou ...
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. Checkstyle 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 examine the thesis.


Examples 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 Javadoc (originally cased JavaDoc) is a documentation generator created by Sun Microsystems for the Java language (now owned by Oracle Corporation) for generating API documentation in HTML format from Java source code. The HTML format is used ...
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 Character or Characters may refer to: Arts, entertainment, and media Literature * ''Character'' (novel), a 1936 Dutch novel by Ferdinand Bordewijk * ''Characters'' (Theophrastus), a classical Greek set of character sketches attributed to The ...
; * The practices of class construction; * Multiple complexity measurements.


Usage

Checkstyle is available as a JAR file which can run inside a Java VM or as an
Apache Ant Apache Ant is a software tool for automating software build processes which originated from the Apache Tomcat project in early 2000 as a replacement for the Make build tool of Unix. It is similar to Make, but is implemented using the Java langu ...
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 or Styler.


See also

*
List of tools for static code analysis This is a list of notable tools for static program analysis (program analysis is a synonym for code analysis). Static code analysis tools Languages Ada * * * * * * * * * * * C, C++ * * * * * * * * * * * ...

EclipseCS
- Eclipse plugin for checkstyle.
Checkstyle-IDEA
- Checkstyle plugin for IntelliJ IDEA and Android Studio
SevNTU-Checkstyle
- extension for EclipseCS with number of check that are not part of checkstyle upstream.
Checkstyle Addons
- Additional Checkstyle checks
Checkstyle for PHP
- a PHP version of Checkstyle


References


External links

* * Static program analysis tools Java (programming language) libraries Java development tools Software using the LGPL license Free software testing tools {{software-eng-stub