I've written a custom check MethodLimitCheck.java
. I also have a custom configuration file myconfigurationfile.xml
which contains the following:
module name="Checker">
<!-- interfaces are limited to 10 methods -->
<module name="com.mycompany.checks.MethodLimitCheck">
<property name="tokens" value="INTERFACE_DEF"/>
<property name="max" value="10"/>
</module>
<!-- normal classes are limited to 25 methods -->
<module name="com.mycompany.checks.MethodLimitCheck">
<property name="tokens" value="CLASS_DEF"/>
<property name="max" value="15"/>
</module>
</module>
</module>
How do I get the checkstyle eclipse plugin to use this custom check? If I reference the myconfigurationfile.xml
in Eclipse -> window -> preferences -> Checkstyle it displays the error:
cannot initialize module TreeWalker - Unable to instantiate
com.mycompany.checks.MethodLimitCheck
cannot initialize module TreeWalker - Unable to instantiate
com.mycompany.checks.MethodLimitCheck
So the plugin is not able to run my custom check using the configuration file that I give it. I don't know where to place the configuration file or the java check that I wrote. There are three different checkstyle folders inside program files -> Eclipse -> plugins.