Groovy Documentation

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

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

class PackageNameRule
extends AbstractAstVisitorRule

Rule that verifies that the package name of a class matches a regular expression. By default it checks that the package name consists of only lowercase letters and numbers, separated by periods.

The regex property specifies the regular expression to check the package name against. It is required and cannot be null or empty. It defaults to '[a-z]+(\.[a-z0-9]+)*'.

The packageNameRequired property indicates whether a package name declaration is required for all classes. It defaults to false.

Authors:
Chris Mair
Hamlet D'Arcy
Version:
\$Revision: 609 \$ - \$Date: 2011-02-24 13:48:43 -0500 (Thu, 24 Feb 2011) \$


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

boolean packageNameRequired

int priority

String regex

 
Method Summary
 
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


packageNameRequired

boolean packageNameRequired


priority

int priority


regex

String regex


 

Groovy Documentation