【发布时间】:2014-04-03 15:11:32
【问题描述】:
是否有带有Google Java Style 的 Checkstyle 规则文件?
【问题讨论】:
-
也许你可以试试 Google 的 error-prone 或 findbugs,他们也为之做出了贡献。
标签: java coding-style checkstyle
是否有带有Google Java Style 的 Checkstyle 规则文件?
【问题讨论】:
标签: java coding-style checkstyle
checkstyle 团队几天前添加了它。这里是 : https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
【讨论】:
如果你有一个maven-project,你可以轻松集成google_checks(你必须至少使用maven-checkstyle-plugin 2.17版)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
</configuration>
</plugin>
执行 checkstyle 将使用 google_checks,例如做
mvn checkstyle:checkstyle
版本背景
Checkstyle-project 集成了来自 version 6.9 的 google_checks。 Maven-checkstyle-plugin 版本 2.17。是第一个,是checkstyle6.9之后发布的(其实是用checkstyle6.11.2)。所以,maven-checkstyle-plugin2.17 是这个插件的第一个版本,它实际上是随 google_checks 一起提供的,并且没有任何其他依赖。
【讨论】:
google_checks 的那个版本? github上的那个使用check style的snapshot版本
Google Summer of Code project 创建这样一个文件意味着它还不存在。
【讨论】:
google_checks.xml 带有 Checkstyle 和 maven 插件。 见Google's Java Style Checkstyle Coverage, 另见Maven Checkstyle Plugin's config
注意,如果你要基于google_checks.xml自定义配置,你需要下载匹配的checkstyle版本的xml(在github上),并在上面修改。
【讨论】: