Groovy Documentation

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

author:
Chris Mair
version:
$Revision: 301 $ - $Date: 2010-01-31 08:21:05 -0500 (Sun, 31 Jan 2010) $


Property Summary
Class astVisitorClass

String name

boolean packageNameRequired

int priority

String regex

 
Constructor Summary
PackageNameRule()

 
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

astVisitorClass

Class astVisitorClass


name

String name


packageNameRequired

boolean packageNameRequired


priority

int priority


regex

String regex


 
Constructor Detail

PackageNameRule

PackageNameRule()


 

Groovy Documentation