简体   繁体   中英

What are the default rules used by checkstyle?

If I don't define a checkstyle config then a couple of checkstyle rules are executed by default, is there a list of default rules used by checkstyle?

This is how my maven config looks like:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <failOnViolation>true</failOnViolation>
                    <consoleOutput>true</consoleOutput>
                    <logViolationsToConsole>true</logViolationsToConsole>
                </configuration>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

You can find the rules on official github https://github.com/checkstyle/checkstyle/tree/master/src/main/resources and read the descriptions on the official website https://checkstyle.sourceforge.io/checks.html

The default configuration is using the predefined ruleset "Sun Microsystems Definition" in sun_checks.xml , see Maven Checkstyle Plugin docs :

There are 2 predefined Checkstyle configuration definitions that ship with the Checkstyle Plugin, the Sun Microsystems Definition is selected by default.

  • sun_checks.xml - Sun Microsystems Definition (default).
  • google_checks.xml - Google Definition.

The contents of the ruleset can be found at Checkstyle's GitHub repository .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM