MCPcopy Index your code
hub / github.com/checkstyle/checkstyle

github.com/checkstyle/checkstyle @checkstyle-13.7.0 sqlite

repository ↗ · DeepWiki ↗ · release checkstyle-13.7.0 ↗
44,215 symbols 156,429 edges 6,548 files 9,438 documented · 21% 15 cross-repo links
README

Checkstyle - Java Code Quality Tool


Checkstyle is a tool that ensures adherence to a code standard or a set of best practices.

The latest release version can be found at GitHub releases or at Maven repo.

Documentation is available in HTML format, see Checkstyle checks.

Table of Contents

Quick Start

$ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
  <module name="TreeWalker">
    <module name="FallThrough"/>
  </module>
</module>

$ cat Test.java
class Test {
  public void foo() {
    int i = 0;
    while (i >= 0) {
      switch (i) {
        case 1:
        case 2:
          i++;
        case 3: // violation 'fall from previous branch of the switch'
          i++;
      }
    }
  }
}

$ java -jar checkstyle-10.18.1-all.jar -c config.xml Test.java
Starting audit...
[ERROR] Test.java:9:9: Fall through from previous branch of switch statement [FallThrough]
Audit done.
Checkstyle ends with 1 errors.

Contributing

Thanks for your interest in contributing to CheckStyle! Please see the Contribution Guidelines for information on how to contribute to the project. This includes creating issues, submitting pull requests, and setting up your development environment.

Build Instructions

Please see the Build Instructions for information on how to build the project.

Feedback and Support

  • Visit our Discussions Page, where you can ask questions and discuss the project with other users and contributors. This is our preferred method of communication for topics like usage and configuration questions, debugging, and other feedback.
  • Stack Overflow is another place to ask questions about Checkstyle usage.
  • If you are interested in contributing to the project, you can join our Discord Contributors Chat with invite link.
  • Our Google Groups Forum is a mailing list for discussion and support; however, we may be slow to respond there.

Javadoc

Take a look at our javadoc to see our API documentation.

Sponsor Checkstyle

Checkstyle is an open-source project that is developed and maintained by volunteers. If you find Checkstyle useful, please consider sponsoring the project. Your support helps us to maintain and improve Checkstyle.

Licensing

Checkstyle is licensed under the GNU LGPL v2.1 License. Checkstyle uses libraries:

Development Tools Powered by

JetBrains logo.

JProfiler logo.

Extension points exported contracts — how you extend this code

Predicate (Interface)
Some javadoc. [341 implementers]
src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundArrowCorrect.java
Inter (Interface)
demonstrate bug in local final variable [471 implementers]
src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/missingjavadoctype/InputMissingJavadocTypeInner.java
TreeWalkerFilter (Interface)
An interface for filtering TreeWalkerAuditEvent. [38 implementers]
src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerFilter.java
firstName (Interface)
(no doc)
src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/naming/typename/Example2.java
VoidPredicate (Interface)
Some javadoc. [38 implementers]
src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundArrowCorrect.java
Inter (Interface)
demonstrate bug in local final variable [471 implementers]
src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctype/InputJavadocTypeInner.java
BeforeExecutionFileFilter (Interface)
An interface for before execution file filtering events. [35 implementers]
src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilter.java
firstName (Interface)
(no doc)
src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/naming/typename/Example3.java

Core symbols most depended-on inside this repo

addProperty
called by 1826
src/main/java/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java
getType
called by 1007
src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java
equals
called by 911
src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsOne.java
toString
called by 869
src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/missingoverride/InputMissingOverrideBadOverrideFromObject.java
findFirstToken
called by 820
src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java
getParent
called by 503
src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java
getFirstChild
called by 434
src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java
getNextSibling
called by 418
src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java

Shape

Method 30,536
Class 11,530
Interface 1,129
Enum 949
Function 71

Languages

Java100%
TypeScript1%

Modules by API surface

src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java233 symbols
src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java196 symbols
src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/variabledeclarationusagedistance/InputVariableDeclarationUsageDistanceScopes.java119 symbols
src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/variabledeclarationusagedistance/InputVariableDeclarationUsageDistanceRegExp.java119 symbols
src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/variabledeclarationusagedistance/InputVariableDeclarationUsageDistanceGeneral.java119 symbols
src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/variabledeclarationusagedistance/InputVariableDeclarationUsageDistanceFinal.java119 symbols
src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/variabledeclarationusagedistance/InputVariableDeclarationUsageDistanceDefault.java119 symbols
src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/variabledeclarationusagedistance/InputVariableDeclarationUsageDistance.java119 symbols
src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java107 symbols
src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822declaredwhenneeded/InputDeclaredWhenNeeded.java103 symbols
src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/finallocalvariable/InputFinalLocalVariableFalsePositives.java99 symbols
src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java99 symbols

Dependencies from manifests, versioned

com.github.caciocavallosilano:cacio-tta1.18 · 1×
com.github.caciocavallosilano:cacio-tta-jdk252.0 · 1×
com.github.sevntu-checkstyle:sevntu-checks
com.google.guava:guava33.6.0-jre · 1×
com.google.truth:truth1.4.4 · 1×
com.groupcdg.pitest:pitest-accelerator-junit5
com.puppycrawl.tools:checkstyle-openrewrite-recipes
com.tngtech.archunit:archunit-junit51.4.2 · 1×
commons-beanutils:commons-beanutils1.11.0 · 1×
de.thetaphi:forbiddenapis

For agents

$ claude mcp add checkstyle \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact