Groovy Documentation

org.codenarc.rule.naming
[Groovy] Class ClassNameRule

java.lang.Object
  org.codenarc.rule.AbstractRule
      org.codenarc.rule.AbstractAstVisitorRule
          org.codenarc.rule.naming.ClassNameRule

class ClassNameRule
extends AbstractAstVisitorRule

Rule that verifies that the name of a class matches a regular expression. By default it checks that the class name starts with an uppercase letter and is followed by zero or more word characters (letters, numbers or underscores). Implicit classes (i.e. Groovy scripts) are ignored. This rule applies to all classes, including abstract classes and interfaces.

The regex property specifies the regular expression to check the class name against. It is required and cannot be null or empty. It defaults to '[A-Z]\w*'.

Authors:
Chris Mair
Version:
\$Revision: 439 \$ - \$Date: 2010-11-08 15:16:30 -0500 (Mon, 08 Nov 2010) \$
See Also:
AbstractClassNameRule
InterfaceNameRule


Field Summary
 
Fields inherited from class AbstractAstVisitorRule
DEFAULT_CONST_NAME, DEFAULT_FIELD_NAME, DEFAULT_TEST_CLASS_NAMES, DEFAULT_TEST_FILES, DEFAULT_VAR_NAME
 
Property Summary
Class astVisitorClass

String name

int priority

String regex

 
Method Summary
void validate()

 
Methods inherited from class AbstractAstVisitorRule
applyTo, getAstVisitor, shouldApplyThisRuleTo
 
Methods inherited from class AbstractRule
applyTo, applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getImportsSortedByLineNumber, getName, getPriority, isReady, packageNameForImport, setName, setPriority, sourceLineAndNumberForImport, sourceLineAndNumberForImport, toString, validate
 

Property Detail

astVisitorClass

Class astVisitorClass


name

String name


priority

int priority


regex

String regex


 
Method Detail

validate

void validate()


 

Groovy Documentation