ruleset { description ''' A Sample Groovy RuleSet containing all CodeNarc Rules You can use this as a template for your own custom RuleSet. Just delete the rules that you don't want to include. ''' AbcComplexity // DEPRECATED: Use the AbcMetric rule instead. Requires the GMetrics jar AbcMetric // Requires the GMetrics jar AbstractClassName AbstractClassWithPublicConstructor AbstractClassWithoutAbstractMethod AddEmptyString AssertWithinFinallyBlock AssignCollectionSort AssignCollectionUnique AssignmentInConditional AssignmentToStaticFieldFromInstanceMethod BigDecimalInstantiation BitwiseOperatorInConditional BlankLineBeforePackage BooleanGetBoolean BooleanMethodReturnsNull BracesForClass BracesForForLoop BracesForIfElse BracesForMethod BracesForTryCatchFinally BrokenNullCheck BrokenOddnessCheck BuilderMethodWithSideEffects BusyWait CatchArrayIndexOutOfBoundsException CatchError CatchException CatchIllegalMonitorStateException CatchIndexOutOfBoundsException CatchNullPointerException CatchRuntimeException CatchThrowable ChainedTest ClassForName ClassJavadoc ClassName ClassNameSameAsFilename ClassNameSameAsSuperclass ClassSize CloneWithoutCloneable CloneableWithoutClone CloseWithoutCloseable ClosureAsLastMethodParameter ClosureStatementOnOpeningLineOfMultipleLineClosure CollectAllIsDeprecated CompareToWithoutComparable ComparisonOfTwoConstants ComparisonWithSelf ConfusingClassNamedException ConfusingMethodName ConfusingMultipleReturns ConfusingTernary ConsecutiveBlankLines ConsecutiveLiteralAppends ConsecutiveStringConcatenation ConstantAssertExpression ConstantIfExpression ConstantTernaryExpression ConstantsOnlyInterface CouldBeElvis CoupledTestCase CrapMetric // Requires the GMetrics jar and a Cobertura coverage file CyclomaticComplexity // Requires the GMetrics jar DeadCode DirectConnectionManagement DoubleCheckedLocking DoubleNegative DuplicateCaseStatement DuplicateImport DuplicateListLiteral DuplicateMapKey DuplicateMapLiteral /* This is a pointless check 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 ExplicitCallToRightShiftMethod ExplicitCallToXorMethod ExplicitGarbageCollection ExplicitHashMapInstantiation ExplicitHashSetInstantiation ExplicitLinkedHashMapInstantiation ExplicitLinkedListInstantiation ExplicitStackInstantiation ExplicitTreeSetInstantiation FactoryMethodName FieldName FileCreateTempFile FileEndsWithoutNewline FinalClassWithProtectedMember ForLoopShouldBeWhileLoop ForStatementBraces GStringAsMapKey GStringExpressionWithinString GetterMethodCouldBeProperty GrailsDomainHasEquals GrailsDomainHasToString GrailsDomainReservedSqlKeywordName GrailsDomainWithServiceReference GrailsDuplicateConstraint GrailsDuplicateMapping GrailsMassAssignment GrailsPublicControllerMethod GrailsServletContextReference GrailsSessionReference // DEPRECATED GrailsStatelessService GroovyLangImmutable HardCodedWindowsFileSeparator HardCodedWindowsRootDirectory HashtableIsObsolete IfStatementBraces /* "Uh yes, we'd like you to make your code more unreadable" IfStatementCouldBeTernary */ IllegalClassMember IllegalClassReference IllegalPackageReference IllegalRegex IllegalString IllegalSubclass ImplementationAsType ImportFromSamePackage ImportFromSunPackages InconsistentPropertyLocking InconsistentPropertySynchronization InsecureRandom /* instanceof is useful in Groovy, not sure why this check is here Instanceof */ IntegerGetInteger InterfaceName InterfaceNameSameAsSuperInterface InvertedIfElse JUnitAssertAlwaysFails JUnitAssertAlwaysSucceeds JUnitAssertEqualsConstantActualValue JUnitFailWithoutMessage JUnitLostTest JUnitPublicField JUnitPublicNonTestMethod JUnitPublicProperty JUnitSetUpCallsSuper JUnitStyleAssertions JUnitTearDownCallsSuper JUnitTestMethodWithoutAssert JUnitUnnecessarySetUp JUnitUnnecessaryTearDown JUnitUnnecessaryThrowsException JavaIoPackageAccess JdbcConnectionReference JdbcResultSetReference JdbcStatementReference LineLength LocaleSetDefault LoggerForDifferentClass LoggerWithWrongModifiers LoggingSwallowsStacktrace LongLiteralWithLowerCaseL MethodCount MethodName MethodSize MisorderedStaticImports MissingBlankLineAfterImports MissingBlankLineAfterPackage MissingNewInThrowStatement MultipleLoggers MultipleUnaryOperators NestedBlockDepth NestedForLoop NestedSynchronization NoDef NoWildcardImports NonFinalPublicField NonFinalSubclassOfSensitiveInterface ObjectFinalize ObjectOverrideMisspelledMethodName PackageName PackageNameMatchesFilePath ParameterCount ParameterName ParameterReassignment PrintStackTrace Println PrivateFieldCouldBeFinal PropertyName PublicFinalizeMethod PublicInstanceField RandomDoubleCoercedToZero RemoveAllOnSelf RequiredRegex RequiredString ReturnFromFinallyBlock ReturnNullFromCatchBlock ReturnsNullInsteadOfEmptyArray ReturnsNullInsteadOfEmptyCollection SerialPersistentFields SerialVersionUID /* Not needed SerializableClassMustDefineSerialVersionUID */ SimpleDateFormatMissingLocale SpaceAfterCatch SpaceAfterClosingBrace SpaceAfterComma SpaceAfterFor SpaceAfterIf SpaceAfterOpeningBrace SpaceAfterSemicolon SpaceAfterSwitch SpaceAfterWhile SpaceAroundClosureArrow /* I prefer a little extra space SpaceAroundMapEntryColon */ SpaceAroundOperator SpaceBeforeClosingBrace SpaceBeforeOpeningBrace SpockIgnoreRestUsed StatelessClass StatelessSingleton StaticCalendarField StaticConnection StaticDateFormatField StaticMatcherField 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 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 /* I quite like explicit return estatements UnnecessaryReturnKeyword */ UnnecessarySafeNavigationOperator UnnecessarySelfAssignment UnnecessarySemicolon UnnecessaryStringInstantiation UnnecessarySubstring UnnecessaryTernaryExpression UnnecessaryToString UnnecessaryTransientModifier UnsafeArrayDeclaration UnsafeImplementationAsMap UnusedArray UnusedImport /* Some interfaces require no use for the method parameter UnusedMethodParameter */ UnusedObject UnusedPrivateField UnusedPrivateMethod UnusedPrivateMethodParameter UnusedVariable UseAssertEqualsInsteadOfAssertTrue UseAssertFalseInsteadOfNegation UseAssertNullInsteadOfAssertEquals UseAssertSameInsteadOfAssertTrue UseAssertTrueInsteadOfAssertEquals UseAssertTrueInsteadOfNegation UseCollectMany UseCollectNested UseOfNotifyMethod VariableName VectorIsObsolete VolatileArrayField VolatileLongOrDoubleField WaitOutsideOfWhileLoop WhileStatementBraces } doNotApplyToClassNames = 'Main' // vim: ft=groovy