IntelliJ Idea中的checkstyle配置问题

Ani*_*Pal 8 java intellij-idea checkstyle

我的目标是实现Google的Java Style Checkstyle,如https://google-styleguide.googlecode.com/svn-history/r130/trunk/javaguide.html中所述.

在IntelliJ中,我启用了Checkstyle插件并尝试指向checkstyle xml(从https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml下载).

我有以下异常:

Property 'fileExtensions' in module Checker does not exist
Run Code Online (Sandbox Code Playgroud)

虽然此属性在xml中定义为

<property name="fileExtensions" value="java, properties, xml"/>
Run Code Online (Sandbox Code Playgroud)

例外细节:

org.infernus.idea.checkstyle.exception.CheckStylePluginException:
The CheckStyle rules file could not be loaded.
Property 'fileExtensions' in module Checker does not exist, please check the documentation
at org.infernus.idea.checkstyle.checker.CheckerFactory.blacklistAndShowMessage(CheckerFactory.java:248)
at org.infernus.idea.checkstyle.checker.CheckerFactory.createChecker(CheckerFactory.java:202)
Run Code Online (Sandbox Code Playgroud)

bar*_*uin 16

您遇到了版本问题.在撰写本文时,Checkstyle的IntelliJ插件仍然在6.1.1版本上,因为IntelliJ仍在MacOS上的Java 6下运行.Checkstyle 6.1.1是仍然使用Java 6的最后一个Checkstyle版本.

fileExtensions物业在Checkstyle 6.3中引入.今天的google_checks.xml也使用了Checkstyle 6.5中引入的EmptyCatchBlock检查.

因此,为了今天在IntelliJ中使用Google检查,您必须使用基于Checkstyle 6.1.1的google_checks.xml版本,可以在此处找到.