New way To Configure a RuleSet for Static Groovy Code analysis using CodeNarc plugin
The CodeNarc plugin provides static code analysis using CodeNarc library. CodeNarc analyzes Groovy code for defects, bad practices, inconsistencies, style issues etc. CodeNarc provides a Groovy DSL for defining RuleSets.
Install CodeNarc plugin into you grails project. Now create one groovy file say CustomRules.groovy and add following code into it.
[java]
ruleset {
Println
SystemOutPrint //these are the rules from CodeNarc library
}
[/java]
The above configuration will look for Println and SystemOutPrint (Logging Rules) rule violation in your project. see all rules.
Now add location of this file in Config.properties
[java]
codenarc.ruleSetFiles="file:grails-app/conf/CustomRules.groovy"
[/java]
and you are done with configuring custom rule, Now you can run codenarc for configured rule.
Hope this helps
Ankur
ankur@intelligrape.com
I think this is a real great article.Really thank you! Fantastic.
I appreciate you sharing this blog article.Really looking forward to read more. Really Great.