org.codenarc.rule.grails
Class GrailsServletContextReferenceRule
java.lang.Object
org.codenarc.rule.AbstractRule
org.codenarc.rule.AbstractAstVisitorRule
org.codenarc.rule.grails.GrailsServletContextReferenceRule
class GrailsServletContextReferenceRule
extends AbstractAstVisitorRule
Rule that checks for references to the servletContext object from within Grails controller and
taglib classes.
This rule is intended as a "governance" rule to enable monitoring and controlling access to the
servletContext from within application source code. Storing objects in the servletContext may
inhibit scalability and/or performance and should be carefully considered. Furthermore, access
to the servletContext is not synchronized, so reading/writing objects from the servletConext must
be manually synchronized, as described in The Definitive Guide to Grails (2nd edition).
Enabling this rule may make most sense in a team environment where team members exhibit a broad
range of skill and experience levels. Appropriate servletContext access can be configured as
exceptions to this rule by configuring either the doNotApplyToFilenames
or
doNotApplyToFilesMatching
property of the rule.
This rule sets the default value of applyToFilesMatching
to only match files
under the 'grails-app/controllers' or 'grails-app/taglib' folders. You can override this
with a different regular expression value if appropriate.
- author:
- Chris Mair
- version:
- $Revision: 303 $ - $Date: 2010-02-02 20:36:02 -0500 (Tue, 02 Feb 2010) $
Methods inherited from class AbstractRule
|
applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getImportsSortedByLineNumber, getName, getPriority, packageNameForImport, setName, setPriority, sourceLineAndNumberForImport, sourceLineAndNumberForImport |
applyToFilesMatching
String applyToFilesMatching
-
astVisitorClass
Class astVisitorClass
-
name
String name
-
priority
int priority
-
GrailsServletContextReferenceRule
GrailsServletContextReferenceRule()
-
Groovy Documentation