diff --git a/config/codenarc/codenarc.groovy b/config/codenarc/codenarc.groovy index e8505a5..d50f9df 100644 --- a/config/codenarc/codenarc.groovy +++ b/config/codenarc/codenarc.groovy @@ -1,334 +1,28 @@ ruleset { - - description ''' - A Sample Groovy RuleSet containing all CodeNarc Rules, grouped by category. - You can use this as a template for your own custom RuleSet. - Just delete the rules that you don't want to include. - ''' - - // rulesets/basic.xml - AssertWithinFinallyBlock - AssignmentInConditional - BigDecimalInstantiation - BitwiseOperatorInConditional - BooleanGetBoolean - BrokenNullCheck - BrokenOddnessCheck - ClassForName - ComparisonOfTwoConstants - ComparisonWithSelf - ConstantAssertExpression - ConstantIfExpression - ConstantTernaryExpression - DeadCode - DoubleNegative - DuplicateCaseStatement - DuplicateMapKey - DuplicateSetValue - EmptyCatchBlock - EmptyClass - EmptyElseBlock - EmptyFinallyBlock - EmptyForStatement - EmptyIfStatement - EmptyInstanceInitializer - EmptyMethod - EmptyStaticInitializer - EmptySwitchStatement - EmptySynchronizedStatement - EmptyTryBlock - EmptyWhileStatement - EqualsAndHashCode - EqualsOverloaded - ExplicitGarbageCollection - ForLoopShouldBeWhileLoop - HardCodedWindowsFileSeparator - HardCodedWindowsRootDirectory - IntegerGetInteger - MultipleUnaryOperators - RandomDoubleCoercedToZero - RemoveAllOnSelf - ReturnFromFinallyBlock - ThrowExceptionFromFinallyBlock - - // rulesets/braces.xml - ElseBlockBraces - ForStatementBraces - IfStatementBraces - WhileStatementBraces - - // rulesets/concurrency.xml - BusyWait - DoubleCheckedLocking - InconsistentPropertyLocking - InconsistentPropertySynchronization - NestedSynchronization - StaticCalendarField - StaticConnection - StaticDateFormatField - StaticMatcherField - StaticSimpleDateFormatField - SynchronizedMethod - SynchronizedOnBoxedPrimitive - SynchronizedOnGetClass - SynchronizedOnReentrantLock - SynchronizedOnString - SynchronizedOnThis - SynchronizedReadObjectMethod - SystemRunFinalizersOnExit - ThisReferenceEscapesConstructor - ThreadGroup - ThreadLocalNotStaticFinal - ThreadYield - UseOfNotifyMethod - VolatileArrayField - VolatileLongOrDoubleField - WaitOutsideOfWhileLoop - - // rulesets/convention.xml - ConfusingTernary - CouldBeElvis - HashtableIsObsolete - IfStatementCouldBeTernary - InvertedIfElse - LongLiteralWithLowerCaseL - NoDef - NoTabCharacter - ParameterReassignment - TernaryCouldBeElvis - TrailingComma - VectorIsObsolete - - // rulesets/design.xml - AbstractClassWithPublicConstructor - AbstractClassWithoutAbstractMethod - AssignmentToStaticFieldFromInstanceMethod - BooleanMethodReturnsNull - BuilderMethodWithSideEffects - CloneableWithoutClone - CloseWithoutCloseable - CompareToWithoutComparable - ConstantsOnlyInterface - EmptyMethodInAbstractClass - FinalClassWithProtectedMember - ImplementationAsType - Instanceof - LocaleSetDefault - NestedForLoop - PrivateFieldCouldBeFinal - PublicInstanceField - ReturnsNullInsteadOfEmptyArray - ReturnsNullInsteadOfEmptyCollection - SimpleDateFormatMissingLocale - StatelessSingleton - ToStringReturnsNull - - // rulesets/dry.xml - DuplicateListLiteral - DuplicateMapLiteral - DuplicateNumberLiteral - DuplicateStringLiteral - - // rulesets/enhanced.xml - //CloneWithoutCloneable - //JUnitAssertEqualsConstantActualValue - //UnsafeImplementationAsMap - - // rulesets/exceptions.xml - CatchArrayIndexOutOfBoundsException - CatchError - CatchException - CatchIllegalMonitorStateException - CatchIndexOutOfBoundsException - CatchNullPointerException - CatchRuntimeException - CatchThrowable - ConfusingClassNamedException - ExceptionExtendsError - ExceptionExtendsThrowable - ExceptionNotThrown - MissingNewInThrowStatement - ReturnNullFromCatchBlock - SwallowThreadDeath - ThrowError - ThrowException - ThrowNullPointerException - ThrowRuntimeException - ThrowThrowable - - // rulesets/formatting.xml - BlankLineBeforePackage - BracesForClass - BracesForForLoop - BracesForIfElse - BracesForMethod - BracesForTryCatchFinally - ClassJavadoc - ClosureStatementOnOpeningLineOfMultipleLineClosure - ConsecutiveBlankLines - FileEndsWithoutNewline - LineLength - MissingBlankLineAfterImports - MissingBlankLineAfterPackage - SpaceAfterCatch - SpaceAfterClosingBrace - SpaceAfterComma - SpaceAfterFor - SpaceAfterIf - SpaceAfterOpeningBrace - SpaceAfterSemicolon - SpaceAfterSwitch - SpaceAfterWhile - SpaceAroundClosureArrow - SpaceAroundMapEntryColon - SpaceAroundOperator - SpaceBeforeClosingBrace - SpaceBeforeOpeningBrace - TrailingWhitespace - - // rulesets/generic.xml - IllegalClassMember - IllegalClassReference - IllegalPackageReference - IllegalRegex - IllegalString - IllegalSubclass - RequiredRegex - RequiredString - StatelessClass - - // rulesets/grails.xml - GrailsDomainHasEquals - GrailsDomainHasToString - GrailsDomainReservedSqlKeywordName - GrailsDomainWithServiceReference - GrailsDuplicateConstraint - GrailsDuplicateMapping - GrailsMassAssignment - GrailsPublicControllerMethod - GrailsServletContextReference - GrailsSessionReference // DEPRECATED - GrailsStatelessService - - // rulesets/groovyism.xml - 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 - GStringExpressionWithinString - GetterMethodCouldBeProperty - GroovyLangImmutable - UseCollectMany - UseCollectNested - - // rulesets/imports.xml - DuplicateImport - ImportFromSamePackage - ImportFromSunPackages - MisorderedStaticImports - NoWildcardImports - UnnecessaryGroovyImport - UnusedImport - - // rulesets/jdbc.xml - DirectConnectionManagement - JdbcConnectionReference - JdbcResultSetReference - JdbcStatementReference - - // rulesets/junit.xml - ChainedTest - CoupledTestCase - JUnitAssertAlwaysFails - JUnitAssertAlwaysSucceeds - JUnitFailWithoutMessage - JUnitLostTest - JUnitPublicField - JUnitPublicNonTestMethod - JUnitPublicProperty - JUnitSetUpCallsSuper - JUnitStyleAssertions - JUnitTearDownCallsSuper - JUnitTestMethodWithoutAssert - JUnitUnnecessarySetUp - JUnitUnnecessaryTearDown - JUnitUnnecessaryThrowsException - SpockIgnoreRestUsed - UnnecessaryFail - UseAssertEqualsInsteadOfAssertTrue - UseAssertFalseInsteadOfNegation - UseAssertNullInsteadOfAssertEquals - UseAssertSameInsteadOfAssertTrue - UseAssertTrueInsteadOfAssertEquals - UseAssertTrueInsteadOfNegation - - // rulesets/logging.xml - LoggerForDifferentClass - LoggerWithWrongModifiers - LoggingSwallowsStacktrace - MultipleLoggers - PrintStackTrace - Println - SystemErrPrint - SystemOutPrint - - // rulesets/naming.xml - AbstractClassName - ClassName - ClassNameSameAsFilename - ClassNameSameAsSuperclass - ConfusingMethodName - FactoryMethodName - FieldName - InterfaceName - InterfaceNameSameAsSuperInterface - MethodName - ObjectOverrideMisspelledMethodName - PackageName - PackageNameMatchesFilePath - ParameterName - PropertyName - VariableName - - // rulesets/security.xml - FileCreateTempFile - InsecureRandom - JavaIoPackageAccess - NonFinalPublicField - NonFinalSubclassOfSensitiveInterface - ObjectFinalize - PublicFinalizeMethod - SystemExit - UnsafeArrayDeclaration - - // rulesets/serialization.xml - EnumCustomSerializationIgnored - SerialPersistentFields - SerialVersionUID - SerializableClassMustDefineSerialVersionUID + description 'Rules Sample Groovy Gradle Project' + + ruleset('rulesets/basic.xml') + ruleset('rulesets/braces.xml') + ruleset('rulesets/concurrency.xml') + ruleset('rulesets/convention.xml') + ruleset('rulesets/design.xml') + ruleset('rulesets/dry.xml') + //ruleset('rulesets/enhanced.xml') + ruleset('rulesets/exceptions.xml') + ruleset('rulesets/formatting.xml') + ruleset('rulesets/generic.xml') + //ruleset('rulesets/grails.xml') + ruleset('rulesets/groovyism.xml') + ruleset('rulesets/imports.xml') + //ruleset('rulesets/jdbc.xml') + //ruleset('rulesets/junit.xml') + ruleset('rulesets/logging.xml') { + 'Println' priority: 1 + 'PrintStackTrace' priority: 1 + } + ruleset('rulesets/naming.xml') + ruleset('rulesets/security.xml') + ruleset('rulesets/serialization.xml') // rulesets/size.xml //AbcComplexity // DEPRECATED: Use the AbcMetric rule instead. Requires the GMetrics jar @@ -341,62 +35,6 @@ ruleset { NestedBlockDepth ParameterCount - // rulesets/unnecessary.xml - AddEmptyString - ConsecutiveLiteralAppends - ConsecutiveStringConcatenation - UnnecessaryBigDecimalInstantiation - UnnecessaryBigIntegerInstantiation - UnnecessaryBooleanExpression - UnnecessaryBooleanInstantiation - UnnecessaryCallForLastElement - UnnecessaryCallToSubstring - UnnecessaryCast - 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 - UnnecessarySafeNavigationOperator - UnnecessarySelfAssignment - UnnecessarySemicolon - UnnecessaryStringInstantiation - UnnecessarySubstring - UnnecessaryTernaryExpression - UnnecessaryToString - UnnecessaryTransientModifier - - // rulesets/unused.xml - UnusedArray - UnusedMethodParameter - UnusedObject - UnusedPrivateField - UnusedPrivateMethod - UnusedPrivateMethodParameter - UnusedVariable - - + ruleset('rulesets/unnecessary.xml') + ruleset('rulesets/unused.xml') } \ No newline at end of file diff --git a/travis.sh b/travis.sh index b193b4a..aed7414 100755 --- a/travis.sh +++ b/travis.sh @@ -13,7 +13,7 @@ if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; th elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then echo "Build for internal pull request" - ./gradlew test --continue sonarqube --info \ + ./gradlew test --continue sonarqube \ -Dsonar.analysis.mode=preview \ -Dsonar.github.oauth=$GITHUB_TOKEN \ -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \