Checkstyle rules for Google Java Style

痴心易碎 提交于 2019-12-10 02:19:12

问题


Is there a Checkstyle rule file with the Google Java Style?


回答1:


The checkstyle team added it several days ago. Here it is : https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml




回答2:


If you have a maven-project, you can easily integrate google_checks (you have to use at least maven-checkstyle-plugin version 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>

Executing checkstyle will use google_checks, e.g. do

mvn checkstyle:checkstyle

Version-background

Checkstyle-project integrates google_checks from version 6.9 on. Maven-checkstyle-plugin version 2.17. is the first one, which is released after checkstyle6.9 (actually it uses checkstyle6.11.2). So, maven-checkstyle-plugin2.17 is the first version of this plugin, which actually ships with google_checks and provides it without any other dependency.




回答3:


The Google Summer of Code project to create such a file implies, that it doesn't exist yet.



来源:https://stackoverflow.com/questions/22841805/checkstyle-rules-for-google-java-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!