Groovy Documentation

Package groovy.org.codenarc.rule.design

 

Class Summary
AbstractClassWithPublicConstructorAstVisitor
AbstractClassWithPublicConstructorRule An abstract class cannot be instantiated, therefore a public constructor is useless and confusing.
AbstractClassWithoutAbstractMethodAstVisitor
AbstractClassWithoutAbstractMethodRule The abstract class does not contain any abstract methods.
ArrayReturnTracker
BooleanMethodReturnsNullAstVisitor
BooleanMethodReturnsNullRule Method with Boolean return type returns explicit null.
BooleanReturnTracker
BuilderMethodWithSideEffectsAstVisitor
BuilderMethodWithSideEffectsRule A builder method is defined as one that creates objects.
CloneableWithoutCloneAstVisitor
CloneableWithoutCloneRule A class that implements Cloneable should define a clone() method.
CloseWithoutCloseableAstVisitor
CloseWithoutCloseableRule If a class defines a "void close()" then that class should implement java.io.Closeable.
CollectionReturnTracker
CompareToWithoutComparableAstVisitor
CompareToWithoutComparableRule If you implement a compareTo method then you should also implement the Comparable interface.
ConstantsOnlyInterfaceAstVisitor
ConstantsOnlyInterfaceRule An interface should be used only to model a behaviour of a class: using an interface as a container of constants is a poor usage pattern.
EmptyMethodInAbstractClassAstVisitor
EmptyMethodInAbstractClassRule An empty method in an abstract class should be abstract instead, as developer may rely on this empty implementation rather than code the appropriate one.
FinalClassWithProtectedMemberAstVisitor
FinalClassWithProtectedMemberRule This rule finds classes marked final that contain protected methods and fields.
ImplementationAsTypeAstVisitor
ImplementationAsTypeRule Checks for use of the following concrete classes when specifying the type of a method parameter, closure parameter, constructor parameter, method return type or field type (the associated interfaces should be used to specify the type instead):
  • java.util.ArrayList
  • java.util.GregorianCalendar
  • java.util.HashMap
  • java.util.HashSet
  • java.util.Hashtable
  • java.util.LinkedHashMap
  • java.util.LinkedHashSet
  • java.util.LinkedList
  • java.util.TreeMap
  • java.util.TreeSet
  • java.util.Vector
  • java.util.concurrent.ArrayBlockingQueue
  • java.util.concurrent.ConcurrentHashMap
  • java.util.concurrent.ConcurrentLinkedQueue
  • java.util.concurrent.CopyOnWriteArrayList
  • java.util.concurrent.CopyOnWriteArraySet
  • java.util.concurrent.DelayQueue
  • java.util.concurrent.LinkedBlockingQueue
  • java.util.concurrent.PriorityBlockingQueue
  • java.util.concurrent.PriorityQueue
  • java.util.concurrent.SynchronousQueue
PrivateFieldCouldBeFinalAstVisitor
PrivateFieldCouldBeFinalRule Rule that checks for private fields that are only set within a constructor or field initializer.
PublicInstanceFieldAstVisitor
PublicInstanceFieldRule Using public fields is considered to be a bad design.
ReturnsNullInsteadOfEmptyArrayAstVisitor
ReturnsNullInsteadOfEmptyArrayRule This rule detects when null is returned from a method that might return an array.
ReturnsNullInsteadOfEmptyCollectionRule This rule detects when null is returned from a method that might return a collection.
ReturnsNullInsteadOfEmptyCollectionRuleAstVisitor
SimpleDateFormatMissingLocaleAstVisitor
SimpleDateFormatMissingLocaleRule Be sure to specify a Locale when creating a new instance of SimpleDateFormat; the class is locale-sensitive.
StatelessSingletonAstVisitor
StatelessSingletonRule There is no benefit in creating a stateless Singleton.
 


Groovy Documentation