1
votes

I'm using Netbeans 8.2 and the google_checks.xml file to configure CheckStyle

This is the error that Netbeans is showing:

enter image description here

It seems to be this part of the file:

<module name="SeparatorWrap">
    <property name="id" value="SeparatorWrapMethodRef"/>
    <property name="tokens" value="METHOD_REF"/>
    <property name="option" value="nl"/>
</module>

But according to the doc it is a valid value.

How can I fix this?

Update

According to this answer the problem is that the google_checks.xml I downloaded is using a newer configuration of Checkstyle.

I'm using the Checkstyle Netbeans plugin version 8.1, where can I find the correct google_checks.xml file for that version? I tried downloading the maven-checkstyle-plugin jar from Maven and looking for the file in there but I can't find it.

1

1 Answers

0
votes

As you already found out, the root cause of your problem is that the version of the configuration file does not match the version of Checkstyle you are using. So, you must find out the Checkstyle version and download the matching configuration file.

Afaik, for Checkstyle Beans, the only way to find out the tool version is by looking inside the plugin file. The most recent version of Checkstyle Beans is 4.1.0 (8.2 is the NetBeans IDE version it seems).

  • Inside the binary distribution of the plugin, there is a file called netbeans-checkstyle-library-4.6.15.nbm.
  • Rename to .zip and open
  • Inside, go to the folder netbeans\modules\autoload\ext
  • In that folder, you find the Checkstyle jar with its version. In this case, the Checkstyle version is 6.15.

The matching file may be found here. Note the version number in the URL. You can modify it to get the matching file for other versions.

This is a bit complicated, but you only need to do it once for each new version of Checkstyle Beans, which does not seem to be very often. ;-) Hope this helps!