Groovy Documentation

org.codenarc.rule.naming
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*'.

see:
AbstractClassNameRule
see:
InterfaceNameRule
author:
Chris Mair
version:
$Revision: 70 $ - $Date: 2009-03-01 07:56:18 -0500 (Sun, 01 Mar 2009) $


Property Summary
Class astVisitorClass

String name

int priority

String regex

 
Constructor Summary
ClassNameRule()

 
Method Summary
void validate()

 
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

astVisitorClass

Class astVisitorClass


name

String name


priority

int priority


regex

String regex


 
Constructor Detail

ClassNameRule

ClassNameRule()


 
Method Detail

validate

void validate()


 

Groovy Documentation