Last Published: 23 Mar 2012
General
Home
Downloads
Road Map
Javadocs
Mailing Lists
Bug Tracker
SourceForge Project
Running
Ant Task Usage
Command-Line
Run as a Test
Other Tools/Frameworks
Using
Creating a RuleSet
Creating a Rule
Configuring Rules
Starter RuleSet (All)
Report Types
HTML (HtmlReportWriter)
XML (XmlReportWriter)
Text (TextReportWriter)
Sample Reports
Sample HTML Report
Open Source Projects
Rules
Rule Index
Basic Rules
Braces Rules
Concurrency Rules
Convention Rules
Design Rules
DRY Rules
Exceptions Rules
Formatting Rules
Generic Rules
Grails Rules
Groovyism Rules
Imports Rules
JDBC Rules
JUnit Rules
Logging Rules
Naming Rules
Size/Complexity Rules
Security Rules
Serialization Rules
Unnecessary Rules
Unused Rules
Developing
Developer Guide
Project Documentation
Project Information
Project Reports
Rule Index
CodeNarc
includes 286 rules.
Basic
AssertWithinFinallyBlock
AssignmentInConditional
BigDecimalInstantiation
BitwiseOperatorInConditional
BooleanGetBoolean
BrokenNullCheck
BrokenOddnessCheck
ClassForName
ComparisonOfTwoConstants
ComparisonWithSelf
ConstantAssertExpression
ConstantIfExpression
ConstantTernaryExpression
DeadCode
DoubleNegative
DuplicateCaseStatement
DuplicateMapKey
DuplicateSetValue
EmptyCatchBlock
EmptyElseBlock
EmptyFinallyBlock
EmptyForStatement
EmptyIfStatement
EmptyInstanceInitializer
EmptyMethod
EmptyStaticInitializer
EmptySwitchStatement
EmptySynchronizedStatement
EmptyTryBlock
EmptyWhileStatement
EqualsAndHashCode
EqualsOverloaded
ExplicitGarbageCollection
ForLoopShouldBeWhileLoop
HardCodedWindowsFileSeparator
HardCodedWindowsRootDirectory
IntegerGetInteger
RandomDoubleCoercedToZero
RemoveAllOnSelf
ReturnFromFinallyBlock
ThrowExceptionFromFinallyBlock
Braces
ElseBlockBraces
ForStatementBraces
IfStatementBraces
WhileStatementBraces
Concurrency
BusyWait
DoubleCheckedLocking
InconsistentPropertyLocking
InconsistentPropertySynchronization
NestedSynchronization
StaticCalendarField
StaticConnection
StaticDateFormatField
StaticMatcherField
StaticSimpleDateFormatField
SynchronizedMethod
SynchronizedOnBoxedPrimitive
SynchronizedOnGetClass
SynchronizedOnReentrantLock
SynchronizedOnString
SynchronizedOnThis
SynchronizedReadObjectMethod
SystemRunFinalizersOnExit
ThreadGroup
ThreadLocalNotStaticFinal
ThreadYield
UseOfNotifyMethod
VolatileArrayField
VolatileLongOrDoubleField
WaitOutsideOfWhileLoop
Convention
ConfusingTernary
CouldBeElvis
HashtableIsObsolete
InvertedIfElse
LongLiteralWithLowerCaseL
ParameterReassignment
TernaryCouldBeElvis
VectorIsObsolete
Design
AbstractClassWithPublicConstructor
AbstractClassWithoutAbstractMethod
BooleanMethodReturnsNull
BuilderMethodWithSideEffects
CloneableWithoutClone
CloseWithoutCloseable
CompareToWithoutComparable
ConstantsOnlyInterface
EmptyMethodInAbstractClass
FinalClassWithProtectedMember
ImplementationAsType
PrivateFieldCouldBeFinal
PublicInstanceField
ReturnsNullInsteadOfEmptyArray
ReturnsNullInsteadOfEmptyCollection
SimpleDateFormatMissingLocale
StatelessSingleton
Dry
DuplicateListLiteral
DuplicateMapLiteral
DuplicateNumberLiteral
DuplicateStringLiteral
Exceptions
CatchArrayIndexOutOfBoundsException
CatchError
CatchException
CatchIllegalMonitorStateException
CatchIndexOutOfBoundsException
CatchNullPointerException
CatchRuntimeException
CatchThrowable
ConfusingClassNamedException
ExceptionExtendsError
MissingNewInThrowStatement
ReturnNullFromCatchBlock
SwallowThreadDeath
ThrowError
ThrowException
ThrowNullPointerException
ThrowRuntimeException
ThrowThrowable
Formatting
BracesForClass
BracesForForLoop
BracesForIfElse
BracesForMethod
BracesForTryCatchFinally
ClassJavadoc
LineLength
Generic
IllegalClassReference
IllegalPackageReference
IllegalRegex
RequiredRegex
RequiredString
StatelessClass
Grails
GrailsDomainHasEquals
GrailsDomainHasToString
GrailsPublicControllerMethod
GrailsServletContextReference
GrailsSessionReference
GrailsStatelessService
Groovyism
AssignCollectionSort
AssignCollectionUnique
ClosureAsLastMethodParameter
CollectAllIsDeprecated
ConfusingMultipleReturns
ExplicitArrayListInstantiation
ExplicitCallToAndMethod
ExplicitCallToCompareToMethod
ExplicitCallToDivMethod
ExplicitCallToEqualsMethod
ExplicitCallToGetAtMethod
ExplicitCallToLeftShiftMethod
ExplicitCallToMinusMethod
ExplicitCallToModMethod
ExplicitCallToMultiplyMethod
ExplicitCallToOrMethod
ExplicitCallToPlusMethod
ExplicitCallToPowerMethod
ExplicitCallToRightShiftMethod
ExplicitCallToXorMethod
ExplicitHashMapInstantiation
ExplicitHashSetInstantiation
ExplicitLinkedHashMapInstantiation
ExplicitLinkedListInstantiation
ExplicitStackInstantiation
ExplicitTreeSetInstantiation
GStringAsMapKey
GetterMethodCouldBeProperty
GroovyLangImmutable
UseCollectMany
UseCollectNested
Imports
DuplicateImport
ImportFromSamePackage
ImportFromSunPackages
MisorderedStaticImports
UnnecessaryGroovyImport
UnusedImport
Jdbc
DirectConnectionManagement
JdbcConnectionReference
JdbcResultSetReference
JdbcStatementReference
Junit
ChainedTest
CoupledTestCase
JUnitAssertAlwaysFails
JUnitAssertAlwaysSucceeds
JUnitFailWithoutMessage
JUnitPublicNonTestMethod
JUnitSetUpCallsSuper
JUnitStyleAssertions
JUnitTearDownCallsSuper
JUnitTestMethodWithoutAssert
JUnitUnnecessarySetUp
JUnitUnnecessaryTearDown
SpockIgnoreRestUsed
UnnecessaryFail
UseAssertEqualsInsteadOfAssertTrue
UseAssertFalseInsteadOfNegation
UseAssertNullInsteadOfAssertEquals
UseAssertSameInsteadOfAssertTrue
UseAssertTrueInsteadOfAssertEquals
UseAssertTrueInsteadOfNegation
Logging
LoggerForDifferentClass
LoggerWithWrongModifiers
LoggingSwallowsStacktrace
MultipleLoggers
PrintStackTrace
Println
SystemErrPrint
SystemOutPrint
Naming
AbstractClassName
ClassName
ConfusingMethodName
FactoryMethodName
FieldName
InterfaceName
MethodName
ObjectOverrideMisspelledMethodName
PackageName
ParameterName
PropertyName
VariableName
Security
FileCreateTempFile
InsecureRandom
JavaIoPackageAccess
NonFinalPublicField
NonFinalSubclassOfSensitiveInterface
ObjectFinalize
PublicFinalizeMethod
SystemExit
UnsafeArrayDeclaration
Serialization
SerialPersistentFields
SerialVersionUID
SerializableClassMustDefineSerialVersionUID
Size
AbcComplexity
ClassSize
CrapMetric
CyclomaticComplexity
MethodCount
MethodSize
NestedBlockDepth
Unnecessary
AddEmptyString
ConsecutiveLiteralAppends
ConsecutiveStringConcatenation
UnnecessaryBigDecimalInstantiation
UnnecessaryBigIntegerInstantiation
UnnecessaryBooleanExpression
UnnecessaryBooleanInstantiation
UnnecessaryCallForLastElement
UnnecessaryCallToSubstring
UnnecessaryCatchBlock
UnnecessaryCollectCall
UnnecessaryCollectionCall
UnnecessaryConstructor
UnnecessaryDefInFieldDeclaration
UnnecessaryDefInMethodDeclaration
UnnecessaryDefInVariableDeclaration
UnnecessaryDotClass
UnnecessaryDoubleInstantiation
UnnecessaryElseStatement
UnnecessaryFinalOnPrivateMethod
UnnecessaryFloatInstantiation
UnnecessaryGString
UnnecessaryGetter
UnnecessaryIfStatement
UnnecessaryInstanceOfCheck
UnnecessaryInstantiationToGetClass
UnnecessaryIntegerInstantiation
UnnecessaryLongInstantiation
UnnecessaryModOne
UnnecessaryNullCheck
UnnecessaryNullCheckBeforeInstanceOf
UnnecessaryObjectReferences
UnnecessaryOverridingMethod
UnnecessaryPackageReference
UnnecessaryParenthesesForMethodCallWithClosure
UnnecessaryPublicModifier
UnnecessaryReturnKeyword
UnnecessarySelfAssignment
UnnecessarySemicolon
UnnecessaryStringInstantiation
UnnecessarySubstring
UnnecessaryTernaryExpression
UnnecessaryTransientModifier
Unused
UnusedArray
UnusedMethodParameter
UnusedObject
UnusedPrivateField
UnusedPrivateMethod
UnusedPrivateMethodParameter
UnusedVariable