java - checkstyle 使用的默认规则是什么?

标签 java maven checkstyle suppress-warnings maven-checkstyle-plugin

如果我没有定义 checkstyle 配置,则默认执行几个 checkstyle 规则,是否有 checkstyle 使用的默认规则列表?

这就是我的 Maven 配置的样子:

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

最佳答案

默认配置使用 sun_checks.xml 中预定义的规则集“Sun Microsystems Definition”,请参阅 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.

规则集的内容可以在 Checkstyle's GitHub repository 找到.

关于java - checkstyle 使用的默认规则是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58399346/

相关文章:

maven - 禁用 checkstyle maven 插件生成的源目录

java - 找不到 XML 模式命名空间 http ://www. springframework.org/schema/data/jpa 的 Spring NamespaceHandler

java - 将 checkstyle/google_checks.xml 与 maven-checkstyle-plugin 一起使用时出错

android-studio - Android Checkstyle-调试自定义检查

java - 从 Android 设备到本地服务器的 HTTP 请求

java - 并发 api 的 AbstractQueuedSynchronizer 构建 block 如何没有任何同步?

java - 如何在java中添加n小时

Java 8 Optional 如何处理太多 orElses

java - 无法使用调试器附加到正在运行的 spring 集成测试

gradle - 来自依赖项jar的Checkstyle配置文件