General
Home
Downloads
GitHub Project
Javadoc
Running
Ant Task
Command-Line
[
Docker
]
Run as a Test
Other Tools/Frameworks
Using
Creating a RuleSet
Creating a Rule
Configuring Rules
Config for Grails, Spock, etc.
Starter RuleSet (All)
Report Types
HTML Report
[
SAMPLE
]
Sortable HTML
[
SAMPLE
]
XML Report
[
SAMPLE
]
JSON Report
[
SAMPLE
]
Text/IDE/Compact Reports
Baseline Report
Rules
Rule Index
[
By Name
]
Basic Rules
Braces Rules
Comments Rules
Concurrency Rules
Convention Rules
Design Rules
DRY Rules
Enhanced Rules
Exceptions Rules
Formatting Rules
Generic Rules
Grails Rules
Groovyism Rules
Import Rules
JDBC Rules
JUnit Rules
Logging Rules
Naming Rules
Size/Complexity Rules
Security Rules
Serialization Rules
Unnecessary Rules
Unused Rules
Developing
Developer Guide
Rule Index by Name
CodeNarc
includes 405 rules.
Rules
AbcMetric
(Requires the GMetrics jar)
AbstractClassName
AbstractClassWithPublicConstructor
AbstractClassWithoutAbstractMethod
AddEmptyString
AssertWithinFinallyBlock
AssignCollectionSort
AssignCollectionUnique
AssignmentInConditional
AssignmentToStaticFieldFromInstanceMethod
BigDecimalInstantiation
BitwiseOperatorInConditional
BlankLineBeforePackage
BlockEndsWithBlankLine
BlockStartsWithBlankLine
BooleanGetBoolean
BooleanMethodReturnsNull
BracesForClass
BracesForForLoop
BracesForIfElse
BracesForMethod
BracesForTryCatchFinally
BrokenNullCheck
BrokenOddnessCheck
BuilderMethodWithSideEffects
BusyWait
CatchArrayIndexOutOfBoundsException
CatchError
CatchException
CatchIllegalMonitorStateException
CatchIndexOutOfBoundsException
CatchNullPointerException
CatchRuntimeException
CatchThrowable
ChainedTest
ClassEndsWithBlankLine
ClassForName
ClassJavadoc
ClassName
ClassNameSameAsFilename
ClassNameSameAsSuperclass
ClassNotSerializable
ClassSize
ClassStartsWithBlankLine
CloneWithoutCloneable
CloneableWithoutClone
CloseWithoutCloseable
ClosureAsLastMethodParameter
ClosureInGString
ClosureStatementOnOpeningLineOfMultipleLineClosure
CollectAllIsDeprecated
CompareToWithoutComparable
ComparisonOfTwoConstants
ComparisonWithSelf
CompileStatic
ConfusingClassNamedException
ConfusingMethodName
ConfusingMultipleReturns
ConfusingTernary
ConsecutiveBlankLines
ConsecutiveLiteralAppends
ConsecutiveStringConcatenation
ConstantAssertExpression
ConstantIfExpression
ConstantTernaryExpression
ConstantsOnlyInterface
CouldBeElvis
CouldBeSwitchStatement
CoupledTestCase
CpsCallFromNonCpsMethod
CrapMetric
(Requires the GMetrics jar and a Cobertura coverage file)
CyclomaticComplexity
(Requires the GMetrics jar)
DeadCode
DirectConnectionManagement
DoubleCheckedLocking
DoubleNegative
DuplicateCaseStatement
DuplicateImport
DuplicateListLiteral
DuplicateMapKey
DuplicateMapLiteral
DuplicateNumberLiteral
DuplicateSetValue
DuplicateStringLiteral
ElseBlockBraces
EmptyCatchBlock
EmptyClass
EmptyElseBlock
EmptyFinallyBlock
EmptyForStatement
EmptyIfStatement
EmptyInstanceInitializer
EmptyMethod
EmptyMethodInAbstractClass
EmptyStaticInitializer
EmptySwitchStatement
EmptySynchronizedStatement
EmptyTryBlock
EmptyWhileStatement
EnumCustomSerializationIgnored
EqualsAndHashCode
EqualsOverloaded
ExceptionExtendsError
ExceptionExtendsThrowable
ExceptionNotThrown
ExplicitArrayListInstantiation
ExplicitCallToAndMethod
ExplicitCallToCompareToMethod
ExplicitCallToDivMethod
ExplicitCallToEqualsMethod
ExplicitCallToGetAtMethod
ExplicitCallToLeftShiftMethod
ExplicitCallToMinusMethod
ExplicitCallToModMethod
ExplicitCallToMultiplyMethod
ExplicitCallToOrMethod
ExplicitCallToPlusMethod
ExplicitCallToPowerMethod
ExplicitCallToPutAtMethod
ExplicitCallToRightShiftMethod
ExplicitCallToXorMethod
ExplicitGarbageCollection
ExplicitHashMapInstantiation
ExplicitHashSetInstantiation
ExplicitLinkedHashMapInstantiation
ExplicitLinkedListInstantiation
ExplicitStackInstantiation
ExplicitTreeSetInstantiation
ExpressionInCpsMethodNotSerializable
FactoryMethodName
FieldName
FieldTypeRequired
FileCreateTempFile
FileEndsWithoutNewline
FinalClassWithProtectedMember
ForLoopShouldBeWhileLoop
ForStatementBraces
ForbiddenCallInCpsMethod
GStringAsMapKey
GStringExpressionWithinString
GetterMethodCouldBeProperty
GrailsDomainGormMethods
GrailsDomainHasEquals
GrailsDomainHasToString
GrailsDomainReservedSqlKeywordName
GrailsDomainStringPropertyMaxSize
GrailsDomainWithServiceReference
GrailsDuplicateConstraint
GrailsDuplicateMapping
GrailsMassAssignment
GrailsPublicControllerMethod
GrailsServletContextReference
GrailsStatelessService
GroovyLangImmutable
HardCodedWindowsFileSeparator
HardCodedWindowsRootDirectory
HashtableIsObsolete
IfStatementBraces
IfStatementCouldBeTernary
IllegalClassMember
IllegalClassReference
IllegalPackageReference
IllegalRegex
IllegalString
IllegalSubclass
ImplementationAsType
ImplicitClosureParameter
ImplicitReturnStatement
ImportFromSamePackage
ImportFromSunPackages
InconsistentPropertyLocking
InconsistentPropertySynchronization
Indentation
InsecureRandom
Instanceof
IntegerGetInteger
InterfaceName
InterfaceNameSameAsSuperInterface
InvertedCondition
InvertedIfElse
JUnitAssertAlwaysFails
JUnitAssertAlwaysSucceeds
JUnitAssertEqualsConstantActualValue
JUnitFailWithoutMessage
JUnitLostTest
JUnitPublicField
JUnitPublicNonTestMethod
JUnitPublicProperty
JUnitSetUpCallsSuper
JUnitStyleAssertions
JUnitTearDownCallsSuper
JUnitTestMethodWithoutAssert
JUnitUnnecessarySetUp
JUnitUnnecessaryTearDown
JUnitUnnecessaryThrowsException
JavaIoPackageAccess
JavadocConsecutiveEmptyLines
JavadocEmptyAuthorTag
JavadocEmptyExceptionTag
JavadocEmptyFirstLine
JavadocEmptyLastLine
JavadocEmptyParamTag
JavadocEmptyReturnTag
JavadocEmptySeeTag
JavadocEmptySinceTag
JavadocEmptyThrowsTag
JavadocEmptyVersionTag
JavadocMissingExceptionDescription
JavadocMissingParamDescription
JavadocMissingThrowsDescription
JdbcConnectionReference
JdbcResultSetReference
JdbcStatementReference
LineLength
LocaleSetDefault
LoggerForDifferentClass
LoggerWithWrongModifiers
LoggingSwallowsStacktrace
LongLiteralWithLowerCaseL
MethodCount
MethodName
MethodParameterTypeRequired
MethodReturnTypeRequired
MethodSize
MisorderedStaticImports
MissingBlankLineAfterImports
MissingBlankLineAfterPackage
MissingBlankLineBeforeAnnotatedField
MissingNewInThrowStatement
MissingOverrideAnnotation
MultipleLoggers
MultipleUnaryOperators
NestedBlockDepth
NestedForLoop
NestedSynchronization
NoDef
NoDouble
NoFloat
NoJavaUtilDate
NoScriptBindings
NoTabCharacter
NoWildcardImports
NonFinalPublicField
NonFinalSubclassOfSensitiveInterface
NonSerializableFieldInSerializableClass
ObjectFinalize
ObjectOverrideMisspelledMethodName
ObjectOverrideOnlyNonCpsMethods
OptionalCollectionReturnType
OptionalField
OptionalMethodParameter
PackageName
PackageNameMatchesFilePath
ParameterAssignmentInFilterClosure
ParameterCount
ParameterName
ParameterOrReturnTypeNotSerializable
ParameterReassignment
PrintStackTrace
Println
PrivateFieldCouldBeFinal
PropertyName
PublicFinalizeMethod
PublicInstanceField
PublicMethodsBeforeNonPublicMethods
RandomDoubleCoercedToZero
RemoveAllOnSelf
RequiredRegex
RequiredString
ReturnFromFinallyBlock
ReturnNullFromCatchBlock
ReturnsNullInsteadOfEmptyArray
ReturnsNullInsteadOfEmptyCollection
SerialPersistentFields
SerialVersionUID
SerializableClassMustDefineSerialVersionUID
SimpleDateFormatMissingLocale
SpaceAfterCatch
SpaceAfterClosingBrace
SpaceAfterComma
SpaceAfterCommentDelimiter
SpaceAfterFor
SpaceAfterIf
SpaceAfterMethodCallName
SpaceAfterMethodDeclarationName
SpaceAfterNotOperator
SpaceAfterOpeningBrace
SpaceAfterSemicolon
SpaceAfterSwitch
SpaceAfterWhile
SpaceAroundClosureArrow
SpaceAroundMapEntryColon
SpaceAroundOperator
SpaceBeforeClosingBrace
SpaceBeforeCommentDelimiter
SpaceBeforeOpeningBrace
SpaceInsideParentheses
SpockIgnoreRestUsed
SpockMissingAssert
StatelessClass
StatelessSingleton
StaticCalendarField
StaticConnection
StaticDateFormatField
StaticFieldsBeforeInstanceFields
StaticMatcherField
StaticMethodsBeforeInstanceMethods
StaticSimpleDateFormatField
SwallowThreadDeath
SynchronizedMethod
SynchronizedOnBoxedPrimitive
SynchronizedOnGetClass
SynchronizedOnReentrantLock
SynchronizedOnString
SynchronizedOnThis
SynchronizedReadObjectMethod
SystemErrPrint
SystemExit
SystemOutPrint
SystemRunFinalizersOnExit
TernaryCouldBeElvis
ThisReferenceEscapesConstructor
ThreadGroup
ThreadLocalNotStaticFinal
ThreadYield
ThrowError
ThrowException
ThrowExceptionFromFinallyBlock
ThrowNullPointerException
ThrowRuntimeException
ThrowThrowable
ToStringReturnsNull
TrailingComma
TrailingWhitespace
UnnecessaryBigDecimalInstantiation
UnnecessaryBigIntegerInstantiation
UnnecessaryBooleanExpression
UnnecessaryBooleanInstantiation
UnnecessaryCallForLastElement
UnnecessaryCallToSubstring
UnnecessaryCast
UnnecessaryCatchBlock
UnnecessaryCollectCall
UnnecessaryCollectionCall
UnnecessaryConstructor
UnnecessaryDefInFieldDeclaration
UnnecessaryDefInMethodDeclaration
UnnecessaryDefInVariableDeclaration
UnnecessaryDotClass
UnnecessaryDoubleInstantiation
UnnecessaryElseStatement
UnnecessaryFail
UnnecessaryFinalOnPrivateMethod
UnnecessaryFloatInstantiation
UnnecessaryGString
UnnecessaryGetter
UnnecessaryGroovyImport
UnnecessaryIfStatement
UnnecessaryInstanceOfCheck
UnnecessaryInstantiationToGetClass
UnnecessaryIntegerInstantiation
UnnecessaryLongInstantiation
UnnecessaryModOne
UnnecessaryNullCheck
UnnecessaryNullCheckBeforeInstanceOf
UnnecessaryObjectReferences
UnnecessaryOverridingMethod
UnnecessaryPackageReference
UnnecessaryParenthesesForMethodCallWithClosure
UnnecessaryPublicModifier
UnnecessaryReturnKeyword
UnnecessarySafeNavigationOperator
UnnecessarySelfAssignment
UnnecessarySemicolon
UnnecessarySetter
UnnecessaryStringInstantiation
UnnecessaryTernaryExpression
UnnecessaryToString
UnnecessaryTransientModifier
UnsafeArrayDeclaration
UnsafeImplementationAsMap
UnusedArray
UnusedImport
UnusedMethodParameter
UnusedObject
UnusedPrivateField
UnusedPrivateMethod
UnusedPrivateMethodParameter
UnusedVariable
UseAssertEqualsInsteadOfAssertTrue
UseAssertFalseInsteadOfNegation
UseAssertNullInsteadOfAssertEquals
UseAssertSameInsteadOfAssertTrue
UseAssertTrueInsteadOfAssertEquals
UseAssertTrueInsteadOfNegation
UseCollectMany
UseCollectNested
UseOfNotifyMethod
VariableName
VariableTypeRequired
VectorIsObsolete
VolatileArrayField
VolatileLongOrDoubleField
WaitOutsideOfWhileLoop
WhileStatementBraces