CodeNarc - disable few rules

1.6k views Asked by At

I am working on static Groovy scripts analysis. Only tool I've found is CodeNarc, but how can I edit rulesets, without editting CodeNarc.jar?

I am calling CodeNarc from command line:

java -classpath "binary-tools/CodeNarc/groovy-all-2.4.6-jenkins-1.jar:binary-tools/CodeNarc/CodeNarc-1.0.jar:binary-tools/CodeNarc/log4j-1.2.17.jar:binary-tools/CodeNarc/slf4j-api-1.7.2.jar:binary-tools/CodeNarc/slf4j-jdk14-1.7.2.jar" org.codenarc.CodeNarc -rulesetfiles="rulesets/basic.xml,rulesets/generic.xml,rulesets/logging.xml,rulesets/dry.xml,rulesets/serialization.xml"

I see that I can specify which rulesets form INSIDE CodeNarc I can use, I'd like to disable single rules from given ruleset. How to do it?

1

There are 1 answers

2
jstrater On

Depending on what you are using to manage the jar, there should be a configuration option available to set the rules. The location will vary depending on the configuration in gradle, etc. You can see more at http://codenarc.sourceforge.net/codenarc-configuring-rules.html I highly recommend configuring the ruleset to your preferences as some rules are better for certain types of groovy projects than others. If you add some info about your project type (grails, spring boot, etc) and your build system(gradle, maven, etc), I can provide more specific help.