Automate Java coding standards with Checkstyle
Checkstyle analyzes Java source code against configurable rules for naming, imports, formatting, Javadoc, class design, and more. It helps teams enforce consistent coding standards automatically.
See Checkstyle in Action
Configure a rule, run Checkstyle against your Java source, and get a precise violation.
1 - Configure
<?xml version="1.0"?> <!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd"> <module name="Checker"> <module name="TreeWalker"> <module name="AvoidStarImport"/> </module> </module>
2 - Your Java code
import java.util..*; class Test { List names; }
3 - Run Checkstyle
$ java -jar checkstyle-13.11.0-all.jar -c config.xml Test.java [ERROR] Test.java:1:1: Using the '.*' form of import should be avoided - java.util.*. [AvoidStarImport]
Learn more about configuration and running Checkstyle.
What can Checkstyle check?
Naming
Set conventions for types, methods, parameters, fields, and constants.
Imports
Control star, unused, illegal, and out-of-order imports.
Javadoc
Check documentation presence, structure, summaries, and tags.
Formatting & Whitespace
Enforce spacing, indentation, line wrapping, and other layout rules.
Class Design
Check visibility, extension, utility classes, and type structure.
Coding Practices
Check declarations, control flow, common structural, and complexity issues.
Try a few more checks:
class myClass {}
ERROR Test.java:1:7: Type name 'myClass' must match pattern '^[A-Z][a-zA-Z0-9]*$'. [TypeName]
Enforces PascalCase naming for classes, interfaces, enums, and annotations for consistency.
class MyClass { public void method() {} }
ERROR MyClass.java:1:1: Class 'MyClass' should be declared as final. [FinalClass]
Ensures classes that are not designed for extension are marked as final to prevent inheritance issues.
if (retries > 3) { throw new RuntimeException(); }
ERROR Retry.java:1:15: '3' is a magic number. [MagicNumber]
Flags unexplained numeric literals buried in logic that should be named constants.
// Missing javadoc public void method() {}
ERROR MyClass.java:2:1: Missing a Javadoc comment. [JavadocStyle]
Ensures public methods have Javadoc comments for proper documentation.
public void method() { // code }
ERROR MyClass.java:2:1: '{' should be on the previous line. [LeftCurly]
Enforces opening braces to be on the same line as the declaration for consistent formatting.
Where Checkstyle fits
Checkstyle focuses on configurable, source-level checks and processes Java files one at a time — naming, imports, Javadoc, formatting, and class design. It doesn't determine expression types or build a full inheritance hierarchy, so it's commonly used alongside tools that perform whole-program analysis. Read the detailed limitations for specifics.
Make Checkstyle yours
Adopt an established configuration as a practical starting point, or define exactly which rules apply to your codebase.
Google Java Style
Start from Checkstyle's supplied configuration and coverage notes. See the Google Java Style guide
Sun Conventions
Use the supplied Sun-style configuration and review its coverage. See the Sun Code Conventions
OpenJDK Style
Use the OpenJDK-style configuration for modern Java development. Follows the conventions used in the OpenJDK codebase. See the OpenJDK Style guide
Doc Style
Use the Doc-style configuration focused on Javadoc and documentation quality. Ensures comprehensive and consistent documentation. See the Doc Comments Style guide
Your Own Configuration
Select checks, tune their properties, and set project-specific policies. See Configuration
Use it in your workflow
One configuration, everywhere it needs to run — your build, your terminal, and your CI pipeline.
Maven
Run checks automatically during a Maven build, or generate a standalone project report. Powered by the Maven Checkstyle Plugin
Gradle
Wire Checkstyle into your Gradle verification tasks with the built-in Gradle Checkstyle plugin — no extra setup required.
ANT
Integrate Checkstyle into your ANT build process using the ANT task. Configure checks and generate reports directly from your build.
Command Line
Run the all-in-one JAR straight from your terminal with a supplied or custom configuration. See the command line interface docs.
IDEs
Get real-time feedback as you type in Eclipse, IntelliJ IDEA, NetBeans, and more. See the Active Tools for available plugins.
Checkstyle also plugs into your CI/CD pipeline. See the Active Tools.
Ready to try Checkstyle?
Choose an integration above, adopt a supplied configuration or write your own, and run Checkstyle against your Java sources. Current release is 13.11.0.
Get Started Configuration Browse Checks
Download the latest release from the GitHub releases page or Maven Central . To build from source, check out the development code on GitHub or use jitpack.io to build artifacts directly, even from your own fork.
Additional Information
Previous Version Documentation
The current website contains the documentation for the latest release only. We only support this latest version.
You can find documentation for most old versions using a URL format like https://checkstyle.sourceforge.io/version/X.X where "X.X" is the version number.
Example: https://checkstyle.sourceforge.io/version/6.18 for version 6.18.
Development Cycle
Release:- happens at the end of each month if functional changes exist in the master branch of our repo
- can happen by request by any user who is impacted, but it is not always guaranteed.
Checkstyle is following its own view of Hybrid Romantic and Semantic Versioning: This is in the form of "First.Second.Third"
First digit is representing Romantic version. When it is the only number increasing, the maintainers marked it as a noticeably large breaking compatibility or major conceptual change which occurred from their perspective.
Second digit is Semantic version which is a combination of major and minor. When it is the only number increasing, it means that either some breaking compatibility happened or new features/modules were introduced.
Third digit is Semantic version which is the patch version. When it is the only number increasing, it means that only defects are fixed.
Checkstyle is not using Semantic Versioning due to the reason explained at issue #3709.
JRE and JDK
Runtime of Checkstyle is limited only by minimal version or JRE.
| Checkstyle version | JRE version |
|---|---|
| 13.x | 21 and above |
| 11.x, 12.x | 17 and above |
| 10.x | 11 and above |
| 7.x, 8.x, 9.x | 8 and above |
| 6.x | 6 and above |
| 5.x | 5 and above |
Checkstyle currently is confirmed to be buildable by all JDKs from 21 through 25. Most recent JDKs may be supported. Please report an issue if there are any problems with recent JDKs.
Supported Java Language Version
Checkstyle can parse all Java language features introduced in Java 22 and below. We may support preview features depending on community demand.
Please report an issue if you encounter any issues with the support of the latest Java language features.
Limitations
Checkstyle is a single file static analysis tool, for more details please read the full list of limitations.
Additional Checks
There are other projects that provide additional checks:
| Project name | Link | Remarks |
|---|---|---|
| Checkstyle addons | checkstyle-addons | Provides additional custom rules and enhancements for Checkstyle. |
| SevNTU checkstyle | sevntu-checkstyle | Offers a collection of advanced static analysis checks for Java code. |
| check-tfij-style | check-tfij-style | Provides opinionated Checkstyle rules based on best practices. |
Related Tools
Checkstyle is most useful if you integrate it into your build process or your development environment. The distribution includes:
- An Ant task.
- A command line interface (CLI).
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:
Active Tools
| IDE / Build tool | Main/Initial Author | Available from | Remarks |
|---|---|---|---|
| Codacy | João Machado | codacy-checkstyle | Provides analysis per commit and per pull request. Supports CheckStyle config files. |
| Eclipse/RAD/RDz | Christian Wulf | Lightweight Eclipse Plugin for Quality Assurance Tools | Alternative to the Eclipse-CS plugin. Allows to use custom checks directly without providing an Eclipse Fragment plugin for that purpose. |
| Eclipse/RAD/RDz | David Schneider | Eclipse-CS Home Page | In 2007 was awarded Best Open Source Eclipse-based Developer tool . |
| Gradle | Hans Dockter (initial author) | Checkstyle supported out of the box | Gradle Checkstyle docs |
| IntelliJ IDEA | James Shiell | Checkstyle-idea Project Page | Provides real-time and on-demand scanning. |
| jGRASP | Larry Barowski | jGRASP Home Page | Integrates Checkstyle for code analysis and displays results within the IDE. |
| 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 | Jan Burkhardt | Project Page | Extension for Eclipse-CS plugin which ensures nullness annotations on methods and constructors (JSR305). |
| Bamboo Checkstyle plug-in | Atlassian (formerly by Ross Rowe and Stephan Paulicke) | Bamboo Checkstyle plug-in Home Page | An add-on that will parse and record CheckStyle reports and report your style violations over time. |
| Code Climate | Sivakumar Kailasam | codeclimate-checkstyle | Supports Checkstyle configuration files and integrates with Code Climate's automated code review system. |
| Checkstyle GitHub Actions | Nikita Savinov | Github-action Marketplace | It runs checkstyle on your Pull Requests using github-actions and reviewdog |
| Jenkins Checkstyle plug-in | Jenkins Community | Jenkins Checkstyle plug-in Home Page | This plug-in is supported by the Static Analysis Collector plug-in that collects different analysis results and shows the results in aggregated trend graphs. |
| Maven | Vincent Massol | Checkstyle supported out of the box | example report |
| tIDE | Olympe Team | Built in | Includes built-in Checkstyle support for code analysis during development. |
| NetBeans | Petr Hejl | Checkstyle Beans | Problems with source code are displayed as annotations of the source |
| NetBeans | SQE Team | Software Quality Environment (SQE) | Provides a comprehensive suite of quality assurance tools, including Checkstyle integration. |
| SonarQube | Freddy Mallet (initial author) | Checkstyle SonarQube repository | Demo site of SonarQube |
| jEdit | Todd Papaioannou | JEdit CheckStylePlugin | |
| IntelliJ IDEA | Jakub Slawinski | QAPlug | Provides quality assurance features. |
| JArchitect | JArchitect Team | JArchitect Home Page | Imports XML result files from CheckStyle. |
| SBT | Andrew Johnson | sbt-checkstyle-plugin Project Page | SBT plugin for running Checkstyle on Java source files in an SBT project |
| code-assert | Stefan Niederhauser | code-assert | Assert that the java code of a project satisfies certain checks. Launch checkstyle validation from UTs |
| Emacs JDE | Markus Mohnen | Part of the standard JDEE distribution - | configuration could be seen at jdee-checkstyle.el |
| Neovim | Mathias Fußenegger | nvim-lint | An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support. |
| Visual Studio Code | Sheng Chen | vscode-checkstyle | Checkstyle for Microsoft Visual Studio Code |
| Mega-Linter | Nicolas Vuillamy | Checkstyle supported out of the box | Automatically detect 35 languages, 11 formats, 15 tooling formats and copy-pastes in your repository sources, and apply their related linters. Available as GitHub Action, other CI tools and locally |
| bld | Erik C. Thauvin | Checkstyle Extension for bld | An extension for checking source code in a bld project |
| Vim editor | Community (syntastic) | Plugin syntastic | how to setup. |
Inactive or Old Tools
| IDE / Build tool | Main/Initial Author | Available from | Remarks |
|---|---|---|---|
| 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.






