Search code examples
grailscodenarc

Grails: Turn off Codenarc NoDef rule for controller actions


Is there a way to turn off the Codenarc NoDef rule for Grails controller actions? The rule is a good practice to follow in general but since some actions return a value and some don't, we typically use def to support all variants. I looked around a bit to see if this rule can be turned off for controller actions but came up empty. Does anyone know?


Solution

  • If you are using codenarc plugin then I believe you should be able to disable some of the rules in codenarc rule set file as mentioned in this blog

    http://www.tothenew.com/blog/grails-clean-code-configure-codenarc-plugin/