Jump to content

Checkstyle: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
version update
 
(14 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{Short description|Java code analysis tool}}
{{multiple issues|{{Primary sources|date=July 2010}}
{{multiple issues|{{Primary sources|date=July 2010}}
{{update|date=August 2015}}}}
{{update|date=August 2015}}}}
{{ Infobox software
{{Infobox software
| name = Checkstyle
| name = Checkstyle
| logo = Checkstyle Logo.png
| logo = Checkstyle Logo.png
| screenshot =
| screenshot =
| caption =
| developer =
| caption =
| latest release version = 10.21.0
| developer =
| latest release version = 8.45
| latest release date = {{Start date and age|2024|12|12}}
| latest release date = {{Start date and age|2021|07|31}}
| latest preview version =
| latest preview version =
| latest preview date =
| latest preview date =
| repo = {{URL|https://github.com/checkstyle/checkstyle}}
| operating system = [[Cross-platform]]
| operating system = [[Cross-platform]]
| language =
| programming language = [[Java (programming language)|Java]]
| language =
| programming language = [[Java (programming language)|Java]]
| genre = [[Static code analysis]]
| genre = [[Static code analysis]]
| license = [[Lesser GNU General Public License]]
| license = [[GNU Lesser General Public License]]
| website = {{ConditionalURL}}
| website = {{ConditionalURL}}
}}
}}
'''Checkstyle'''<ref>{{cite web | url = https://checkstyle.org/ | title = Checkstyle Home Page | year = 2010 | access-date = 2010-11-02}}</ref> is a [[static code analysis]] tool used in [[software development]] for checking if [[Java (programming language)|Java]] [[source code]] is compliant with specified [[Programming style|coding rules]].
'''Checkstyle'''<ref>{{cite web | url = https://checkstyle.org/ | title = Checkstyle Home Page | year = 2010 | access-date = 2010-11-02}}</ref> is a [[static code analysis]] tool used in [[software development]] for checking if [[Java (programming language)|Java]] [[source code]] is compliant with specified [[Programming style|coding rules]].
Line 22: Line 24:
Originally developed by Oliver Burn back in 2001, the project is maintained by a team of developers from around the world.
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<ref>{{cite web | url = https://checkstyle.org/releasenotes.html#Release_8.45 | title = checkstyle - Release Notes | year = 2021 | access-date = 2021-08-05}}</ref> which is targeted at the [[Java 8]] language.
The current stable release is version 10.21.0<ref>{{Cite web |title=checkstyle Release Notes |url=https://checkstyle.sourceforge.io/releasenotes.html#Release_10.21.0 |access-date=2024-12-17 |website=checkstyle.sourceforge.io}}</ref> which supports Java versions from 11 to 17.<ref>{{Cite web |title=checkstyle – Checkstyle Home Page |url=https://checkstyle.sourceforge.io/#JRE_and_JDK |access-date=2024-12-17 |website=checkstyle.sourceforge.io}}</ref>


== Advantages and limits ==
== Advantages 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, 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.
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.

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 ==
== Examples of available modules ==
Line 46: Line 45:
== Usage ==
== Usage ==


Checkstyle is available as a [[JAR (file format)|JAR file]] which can run inside a [[Java VM]] or as an [[Apache Ant]] task. It can also be integrated into an [[Integrated development environment|IDE]] or other tools. When Checkstyle errors are found, it is possible to use tools to automatically fix them, such as WalkMod<ref>{{Cite web |title=WalkMod |url=https://walkmod.com/ |access-date=2022-08-24 |website=walkmod.com}}</ref> or Styler.<ref>{{Cite journal |last=Loriot |first=Benjamin |last2=Madeiral |first2=Fernanda |last3=Monperrus |first3=Martin |date=2022-08-06 |title=Styler: learning formatting conventions to repair Checkstyle violations |url=https://doi.org/10.1007/s10664-021-10107-0 |journal=Empirical Software Engineering |language=en |volume=27 |issue=6 |pages=149 |doi=10.1007/s10664-021-10107-0 |issn=1573-7616}}</ref>
Checkstyle is available as a [[JAR (file format)|JAR file]] which can run inside a [[Java VM]] or as an [[Apache Ant]] task. It can also be integrated into an [[Integrated development environment|IDE]] or other tools.


==See also==
==See also==
Line 53: Line 52:
* [https://checkstyle.org/eclipse-cs/ EclipseCS] - Eclipse plugin for checkstyle.
* [https://checkstyle.org/eclipse-cs/ EclipseCS] - Eclipse plugin for checkstyle.
* [https://github.com/jshiell/checkstyle-idea Checkstyle-IDEA] - Checkstyle plugin for IntelliJ IDEA and Android Studio
* [https://github.com/jshiell/checkstyle-idea Checkstyle-IDEA] - Checkstyle plugin for IntelliJ IDEA and Android Studio
* [https://sevntu-checkstyle.github.com/sevntu.checkstyle/ SevNTU-Checkstyle] - extension for EclipseCS with number of check that are not part of checkstyle upstream.
* [https://sevntu-checkstyle.github.com/sevntu.checkstyle/ SevNTU-Checkstyle] {{Webarchive|url=https://web.archive.org/web/20130322001444/http://sevntu-checkstyle.github.com/sevntu.checkstyle/ |date=2013-03-22 }} - extension for EclipseCS with number of check that are not part of checkstyle upstream.
* [https://checkstyle-addons.thomasjensen.com/ Checkstyle Addons] - Additional Checkstyle checks
* [https://checkstyle-addons.thomasjensen.com/ Checkstyle Addons] - Additional Checkstyle checks
* [https://github.com/PHPCheckstyle/phpcheckstyle Checkstyle for PHP] - a PHP version of Checkstyle
* [https://github.com/PHPCheckstyle/phpcheckstyle Checkstyle for PHP] - a PHP version of Checkstyle
Line 63: Line 62:
* {{Official website}}
* {{Official website}}
* {{GitHub|checkstyle/checkstyle}}
* {{GitHub|checkstyle/checkstyle}}

{{Software engineering}}
{{Software engineering}}


Line 70: Line 70:
[[Category:Software using the LGPL license]]
[[Category:Software using the LGPL license]]
[[Category:Free software testing tools]]
[[Category:Free software testing tools]]



{{software-eng-stub}}
{{software-eng-stub}}

Latest revision as of 18:55, 16 December 2024

Checkstyle
Stable release
10.21.0 / December 12, 2024; 20 days ago (2024-12-12)
Repositorygithub.com/checkstyle/checkstyle
Written inJava
Operating systemCross-platform
TypeStatic code analysis
LicenseGNU Lesser 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 10.21.0[2] which supports Java versions from 11 to 17.[3]

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

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.

See also

[edit]

References

[edit]
  1. ^ "Checkstyle Home Page". 2010. Retrieved 2010-11-02.
  2. ^ "checkstyle – Release Notes". checkstyle.sourceforge.io. Retrieved 2024-12-17.
  3. ^ "checkstyle – Checkstyle Home Page". checkstyle.sourceforge.io. Retrieved 2024-12-17.
[edit]