Groovy Documentation

org.codenarc.rule.grails
Class GrailsPublicControllerMethodRule

java.lang.Object
  org.codenarc.rule.AbstractRule
      org.codenarc.rule.AbstractAstVisitorRule
          org.codenarc.rule.grails.GrailsPublicControllerMethodRule

class GrailsPublicControllerMethodRule
extends AbstractAstVisitorRule

Rule that checks for public methods on Grails controller classes. Static methods are ignored.

Grails controller actions and interceptors are defined as properties on the controller class. Public methods on a controller class are unnecessary. They break encapsulation and can be confusing.

This rule sets the default value of applyToFilesMatching to only match files under the 'grails-app/controllers' folder. You can override this with a different regular expression value if appropriate.

This rule also sets the default value of applyToClassNames to only match class names ending in 'Controller'. You can override this with a different class name pattern (String) if appropriate.

author:
Chris Mair
version:
$Revision: 171 $ - $Date: 2009-06-20 16:43:26 -0400 (Sat, 20 Jun 2009) $


Property Summary
String applyToClassNames

String applyToFilesMatching

Class astVisitorClass

String name

int priority

 
Constructor Summary
GrailsPublicControllerMethodRule()

 
Method Summary
 
Methods inherited from class AbstractAstVisitorRule
shouldApplyThisRuleTo
 
Methods inherited from class AbstractRule
applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getImportsSortedByLineNumber, getName, getPriority, packageNameForImport, setName, setPriority, sourceLineAndNumberForImport, sourceLineAndNumberForImport
 

Property Detail

applyToClassNames

String applyToClassNames


applyToFilesMatching

String applyToFilesMatching


astVisitorClass

Class astVisitorClass


name

String name


priority

int priority


 
Constructor Detail

GrailsPublicControllerMethodRule

GrailsPublicControllerMethodRule()


 

Groovy Documentation