Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue in checkstyle configuration in IntelliJ Idea

My objective is to implement Google's Java Style Checkstyle as stated in https://google-styleguide.googlecode.com/svn-history/r130/trunk/javaguide.html .

In IntelliJ I have enabled Checkstyle plugin and try to point checkstyle xml (downloaded from https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml).

I got following exception:

Property 'fileExtensions' in module Checker does not exist

although this property is defined in the xml as

<property name="fileExtensions" value="java, properties, xml"/>

Exception details:

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)
like image 900
Anirban Pal Avatar asked Mar 30 '15 03:03

Anirban Pal


Video Answer


1 Answers

You have run into a version problem. At the time of this writing, the IntelliJ plugin for Checkstyle is still on version 6.1.1, because IntelliJ still runs under Java 6 on MacOS. Checkstyle 6.1.1 is the last Checkstyle version that still used Java 6.

The fileExtensions property was introduced in Checkstyle 6.3. The google_checks.xml of today also makes use of the EmptyCatchBlock check, which was introduced in Checkstyle 6.5.

So, in order to use the Google checks today in IntelliJ, you must use the Checkstyle 6.1.1 based version of google_checks.xml, which may be found here.

like image 59
barfuin Avatar answered Sep 17 '22 12:09

barfuin