From 40b1e01edc4a550aea0ae23ae5ca3852c5a88c6b Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Wed, 31 Oct 2018 14:14:04 +0100 Subject: [PATCH 01/14] upgraded Codenarc and GMetrics --- README.md | 8 ++++---- groovy-jacoco-previous/pom.xml | 2 +- pom.xml | 4 ++-- sonar-groovy-plugin/pom.xml | 4 ++-- tools/sonar-codenarc-converter/pom.xml | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 62ca4e51..5c8ecc03 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,10 @@ The plugin enables analysis of Groovy within SonarQube. It leverages [CodeNarc](http://codenarc.sourceforge.net/) to raise issues against coding rules, [GMetrics](http://gmetrics.sourceforge.net/) for cyclomatic complexity and [Cobertura](http://cobertura.sourceforge.net/) or [JaCoCo](http://www.eclemma.org/jacoco/) for code coverage. -Plugin | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 1.0 | 1.1 | 1.1.1 | 1.2 | 1.3 | 1.3.1 | 1.4 ----------|-----|-----|------|------|--------|------|------|------|-------|------|--------|--------|------- -CodeNarc | 0.9 | 0.9 | 0.13 | 0.15 | 0.16.1 | 0.17 | 0.20 | 0.23 | 0.23 | 0.24 | 0.24.1 | 0.24.1 | 0.25.2 -GMetrics | 0.2 | 0.2 | 0.3 | 0.3 | 0.4 | 0.5 | 0.6 | 0.6 | 0.7 | 0.7 | 0.7 | 0.7 | 0.7 +Plugin | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 1.0 | 1.1 | 1.1.1 | 1.2 | 1.3 | 1.3.1 | 1.4 | 1.6 +---------|-----|-----|------|------|--------|------|------|------|-------|------|--------|--------|------- |------- +CodeNarc | 0.9 | 0.9 | 0.13 | 0.15 | 0.16.1 | 0.17 | 0.20 | 0.23 | 0.23 | 0.24 | 0.24.1 | 0.24.1 | 0.25.2 | 1.2.1 +GMetrics | 0.2 | 0.2 | 0.3 | 0.3 | 0.4 | 0.5 | 0.6 | 0.6 | 0.7 | 0.7 | 0.7 | 0.7 | 0.7 | 1.0 ## Steps to Analyze a Groovy Project 1. Install SonarQube Server diff --git a/groovy-jacoco-previous/pom.xml b/groovy-jacoco-previous/pom.xml index d0bbf444..28a26023 100644 --- a/groovy-jacoco-previous/pom.xml +++ b/groovy-jacoco-previous/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC2-SNAPSHOT + 1.6-RC2 groovy-jacoco-previous diff --git a/pom.xml b/pom.xml index d882752d..5eb61d73 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.sonarsource.groovy groovy - 1.6-RC2-SNAPSHOT + 1.6-RC2 pom Sonar Groovy @@ -62,7 +62,7 @@ 5.6 0.7.4.201502262128 0.7.5.201505241946 - 2.4.4 + 2.5.2 3.11 sonar-groovy diff --git a/sonar-groovy-plugin/pom.xml b/sonar-groovy-plugin/pom.xml index d2e523df..3fa2f500 100644 --- a/sonar-groovy-plugin/pom.xml +++ b/sonar-groovy-plugin/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC2-SNAPSHOT + 1.6-RC2 sonar-groovy-plugin @@ -46,7 +46,7 @@ org.gmetrics GMetrics - 0.7 + 1.0 junit diff --git a/tools/sonar-codenarc-converter/pom.xml b/tools/sonar-codenarc-converter/pom.xml index fb5371ee..67bfaeee 100644 --- a/tools/sonar-codenarc-converter/pom.xml +++ b/tools/sonar-codenarc-converter/pom.xml @@ -57,7 +57,7 @@ org.codenarc CodeNarc - 0.25.2 + 1.2.1 log4j From edf45b48cc7a1f5de1d48f98e3874cbd0444da5b Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Wed, 31 Oct 2018 16:03:14 +0100 Subject: [PATCH 02/14] updated ruleset and profile --- sonar-groovy-plugin/pom.xml | 2 +- .../plugins/groovy/profile-sonar-way.xml | 1678 ++++++++++++++++- .../org/sonar/plugins/groovy/rules.xml | 683 ++++++- 3 files changed, 2181 insertions(+), 182 deletions(-) diff --git a/sonar-groovy-plugin/pom.xml b/sonar-groovy-plugin/pom.xml index 3fa2f500..9eca05ba 100644 --- a/sonar-groovy-plugin/pom.xml +++ b/sonar-groovy-plugin/pom.xml @@ -99,7 +99,7 @@ org.codenarc CodeNarc - 0.25.2 + 1.2.1 ant diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml index 4f75ee78..327cab8a 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml @@ -2,332 +2,1810 @@ Sonar way grvy + + grvy + org.codenarc.rule.basic.BigDecimalInstantiationRule + MINOR + + + grvy + org.codenarc.rule.basic.ConstantIfExpressionRule + MINOR + + + grvy + org.codenarc.rule.basic.ConstantTernaryExpressionRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyCatchBlockRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyElseBlockRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyFinallyBlockRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyForStatementRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyIfStatementRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptySwitchStatementRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptySynchronizedStatementRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyTryBlockRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyWhileStatementRule + MINOR + + + grvy + org.codenarc.rule.basic.EqualsAndHashCodeRule + MINOR + + + grvy + org.codenarc.rule.basic.ReturnFromFinallyBlockRule + MINOR + + + grvy + org.codenarc.rule.basic.ThrowExceptionFromFinallyBlockRule + MINOR + + + grvy + org.codenarc.rule.basic.DeadCodeRule + MINOR + + + grvy + org.codenarc.rule.basic.DoubleNegativeRule + MINOR + + + grvy + org.codenarc.rule.basic.DuplicateCaseStatementRule + MINOR + + + grvy + org.codenarc.rule.basic.RemoveAllOnSelfRule + MINOR + + + grvy + org.codenarc.rule.basic.ExplicitGarbageCollectionRule + MINOR + grvy org.codenarc.rule.basic.AssignmentInConditionalRule + MINOR + + + grvy + org.codenarc.rule.basic.BooleanGetBooleanRule + MINOR + + + grvy + org.codenarc.rule.basic.BrokenOddnessCheckRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyInstanceInitializerRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyMethodRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyStaticInitializerRule + MINOR + + + grvy + org.codenarc.rule.basic.IntegerGetIntegerRule + MINOR + + + grvy + org.codenarc.rule.basic.DuplicateMapKeyRule + MINOR + + + grvy + org.codenarc.rule.basic.DuplicateSetValueRule + MINOR + + + grvy + org.codenarc.rule.basic.EqualsOverloadedRule + MINOR + + + grvy + org.codenarc.rule.basic.ForLoopShouldBeWhileLoopRule + MAJOR + + + grvy + org.codenarc.rule.basic.ClassForNameRule + MINOR + + + grvy + org.codenarc.rule.basic.ComparisonOfTwoConstantsRule + MINOR + + + grvy + org.codenarc.rule.basic.ComparisonWithSelfRule + MINOR + + + grvy + org.codenarc.rule.basic.BitwiseOperatorInConditionalRule + MINOR + + + grvy + org.codenarc.rule.basic.HardCodedWindowsFileSeparatorRule + MINOR + + + grvy + org.codenarc.rule.basic.RandomDoubleCoercedToZeroRule + MINOR + + + grvy + org.codenarc.rule.basic.HardCodedWindowsRootDirectoryRule + MINOR + + + grvy + org.codenarc.rule.basic.AssertWithinFinallyBlockRule + MINOR + + + grvy + org.codenarc.rule.basic.ConstantAssertExpressionRule MAJOR grvy - org.codenarc.rule.exceptions.CatchErrorRule - MAJOR + org.codenarc.rule.basic.BrokenNullCheckRule + MINOR + + + grvy + org.codenarc.rule.basic.EmptyClassRule + MINOR + + + grvy + org.codenarc.rule.basic.MultipleUnaryOperatorsRule + MINOR + + + grvy + org.codenarc.rule.serialization.SerialVersionUIDRule + MINOR + + + grvy + org.codenarc.rule.serialization.SerializableClassMustDefineSerialVersionUIDRule + MINOR + + + grvy + org.codenarc.rule.serialization.SerialPersistentFieldsRule + MINOR + + + grvy + org.codenarc.rule.serialization.EnumCustomSerializationIgnoredRule + MINOR + + + grvy + org.codenarc.rule.braces.IfStatementBracesRule + MINOR + + + grvy + org.codenarc.rule.braces.ElseBlockBracesRule + MINOR + + + grvy + org.codenarc.rule.braces.ForStatementBracesRule + MINOR + + + grvy + org.codenarc.rule.braces.WhileStatementBracesRule + MINOR + + + grvy + org.codenarc.rule.concurrency.NestedSynchronizationRule + MINOR + + + grvy + org.codenarc.rule.concurrency.SynchronizedMethodRule + MINOR + + + grvy + org.codenarc.rule.concurrency.SynchronizedOnThisRule + MINOR + + + grvy + org.codenarc.rule.concurrency.SystemRunFinalizersOnExitRule + MINOR + + + grvy + org.codenarc.rule.concurrency.ThreadGroupRule + MINOR + + + grvy + org.codenarc.rule.concurrency.ThreadLocalNotStaticFinalRule + MINOR + + + grvy + org.codenarc.rule.concurrency.ThreadYieldRule + MINOR + + + grvy + org.codenarc.rule.concurrency.VolatileLongOrDoubleFieldRule + MINOR + + + grvy + org.codenarc.rule.concurrency.SynchronizedOnGetClassRule + MINOR + + + grvy + org.codenarc.rule.concurrency.UseOfNotifyMethodRule + MINOR + + + grvy + org.codenarc.rule.concurrency.BusyWaitRule + MINOR + + + grvy + org.codenarc.rule.concurrency.DoubleCheckedLockingRule + MINOR + + + grvy + org.codenarc.rule.concurrency.InconsistentPropertyLockingRule + MINOR + + + grvy + org.codenarc.rule.concurrency.InconsistentPropertySynchronizationRule + MINOR + + + grvy + org.codenarc.rule.concurrency.StaticCalendarFieldRule + MINOR + + + grvy + org.codenarc.rule.concurrency.StaticDateFormatFieldRule + MINOR + + + grvy + org.codenarc.rule.concurrency.StaticMatcherFieldRule + MINOR + + + grvy + org.codenarc.rule.concurrency.SynchronizedOnBoxedPrimitiveRule + MINOR + + + grvy + org.codenarc.rule.concurrency.SynchronizedOnStringRule + MINOR + + + grvy + org.codenarc.rule.concurrency.SynchronizedReadObjectMethodRule + MINOR + + + grvy + org.codenarc.rule.concurrency.SynchronizedOnReentrantLockRule + MINOR + + + grvy + org.codenarc.rule.concurrency.VolatileArrayFieldRule + MINOR + + + grvy + org.codenarc.rule.concurrency.WaitOutsideOfWhileLoopRule + MINOR + + + grvy + org.codenarc.rule.concurrency.StaticConnectionRule + MINOR + + + grvy + org.codenarc.rule.concurrency.StaticSimpleDateFormatFieldRule + MINOR + + + grvy + org.codenarc.rule.concurrency.ThisReferenceEscapesConstructorRule + MINOR + + + grvy + org.codenarc.rule.design.CloneableWithoutCloneRule + MINOR + + + grvy + org.codenarc.rule.design.ImplementationAsTypeRule + MINOR + + + grvy + org.codenarc.rule.design.BooleanMethodReturnsNullRule + MINOR + + + grvy + org.codenarc.rule.design.ReturnsNullInsteadOfEmptyArrayRule + MINOR + + + grvy + org.codenarc.rule.design.ReturnsNullInsteadOfEmptyCollectionRule + MINOR + + + grvy + org.codenarc.rule.design.CompareToWithoutComparableRule + MINOR + + + grvy + org.codenarc.rule.design.SimpleDateFormatMissingLocaleRule + MINOR + + + grvy + org.codenarc.rule.design.AbstractClassWithoutAbstractMethodRule + MINOR + + + grvy + org.codenarc.rule.design.CloseWithoutCloseableRule + MINOR + + + grvy + org.codenarc.rule.design.ConstantsOnlyInterfaceRule + MINOR + + + grvy + org.codenarc.rule.design.EmptyMethodInAbstractClassRule + MINOR + + + grvy + org.codenarc.rule.design.FinalClassWithProtectedMemberRule + MINOR + + + grvy + org.codenarc.rule.design.PublicInstanceFieldRule + MINOR + + + grvy + org.codenarc.rule.design.StatelessSingletonRule + MINOR + + + grvy + org.codenarc.rule.design.AbstractClassWithPublicConstructorRule + MINOR + + + grvy + org.codenarc.rule.design.BuilderMethodWithSideEffectsRule + MINOR + + + grvy + org.codenarc.rule.design.PrivateFieldCouldBeFinalRule.fixed + MAJOR + + + grvy + org.codenarc.rule.design.CloneWithoutCloneableRule + MINOR + + + grvy + org.codenarc.rule.design.LocaleSetDefaultRule + MINOR + + + grvy + org.codenarc.rule.design.ToStringReturnsNullRule + MINOR + + + grvy + org.codenarc.rule.design.InstanceofRule + MINOR + + + grvy + org.codenarc.rule.design.NestedForLoopRule + MAJOR + + + grvy + org.codenarc.rule.design.AssignmentToStaticFieldFromInstanceMethodRule + MINOR + + + grvy + org.codenarc.rule.dry.DuplicateNumberLiteralRule + MINOR + + + grvy + org.codenarc.rule.dry.DuplicateStringLiteralRule + MINOR + + + grvy + org.codenarc.rule.dry.DuplicateMapLiteralRule + MAJOR + + + grvy + org.codenarc.rule.dry.DuplicateListLiteralRule + MAJOR + + + grvy + org.codenarc.rule.exceptions.CatchErrorRule + MINOR + + + grvy + org.codenarc.rule.exceptions.CatchExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.CatchNullPointerExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.CatchRuntimeExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.CatchThrowableRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ThrowErrorRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ThrowExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ThrowNullPointerExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ThrowRuntimeExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ThrowThrowableRule + MINOR + + + grvy + org.codenarc.rule.exceptions.CatchIllegalMonitorStateExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ConfusingClassNamedExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ReturnNullFromCatchBlockRule + MINOR + + + grvy + org.codenarc.rule.exceptions.CatchArrayIndexOutOfBoundsExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.CatchIndexOutOfBoundsExceptionRule + MINOR + + + grvy + org.codenarc.rule.exceptions.MissingNewInThrowStatementRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ExceptionExtendsErrorRule + MINOR + + + grvy + org.codenarc.rule.exceptions.SwallowThreadDeathRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ExceptionNotThrownRule + MINOR + + + grvy + org.codenarc.rule.exceptions.ExceptionExtendsThrowableRule + MINOR + + + grvy + org.codenarc.rule.generic.IllegalRegexRule.fixed + MAJOR + + + grvy + org.codenarc.rule.generic.RequiredRegexRule.fixed + MAJOR + + + grvy + org.codenarc.rule.generic.RequiredStringRule.fixed + MAJOR + + + grvy + org.codenarc.rule.generic.StatelessClassRule.fixed + MINOR + + + grvy + org.codenarc.rule.generic.IllegalPackageReferenceRule.fixed + MINOR + + + grvy + org.codenarc.rule.generic.IllegalClassReferenceRule.fixed + MINOR + + + grvy + org.codenarc.rule.generic.IllegalClassMemberRule.fixed + MINOR + + + grvy + org.codenarc.rule.generic.IllegalStringRule.fixed + MINOR + + + grvy + org.codenarc.rule.generic.IllegalSubclassRule.fixed + MINOR + + + grvy + org.codenarc.rule.grails.GrailsPublicControllerMethodRule.fixed + MINOR + + + grvy + org.codenarc.rule.grails.GrailsServletContextReferenceRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsStatelessServiceRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsDomainHasToStringRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsDomainHasEqualsRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsDuplicateMappingRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsDuplicateConstraintRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsDomainReservedSqlKeywordNameRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsDomainWithServiceReferenceRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsMassAssignmentRule + MINOR + + + grvy + org.codenarc.rule.grails.GrailsDomainStringPropertyMaxSizeRule + MINOR + + + grvy + org.codenarc.rule.imports.DuplicateImportRule + MAJOR + + + grvy + org.codenarc.rule.imports.ImportFromSamePackageRule + MAJOR + + + grvy + org.codenarc.rule.imports.UnnecessaryGroovyImportRule + MAJOR + + + grvy + org.codenarc.rule.imports.UnusedImportRule + MAJOR + + + grvy + org.codenarc.rule.imports.ImportFromSunPackagesRule + MINOR + + + grvy + org.codenarc.rule.imports.MisorderedStaticImportsRule + MAJOR + + + grvy + org.codenarc.rule.imports.NoWildcardImportsRule + MAJOR + + + grvy + org.codenarc.rule.junit.JUnitAssertAlwaysFailsRule + MINOR + + + grvy + org.codenarc.rule.junit.JUnitAssertAlwaysSucceedsRule + MINOR + + + grvy + org.codenarc.rule.junit.JUnitPublicNonTestMethodRule + MINOR + + + grvy + org.codenarc.rule.junit.JUnitSetUpCallsSuperRule + MINOR + + + grvy + org.codenarc.rule.junit.JUnitTearDownCallsSuperRule + MINOR + + + grvy + org.codenarc.rule.junit.JUnitUnnecessarySetUpRule + MAJOR + + + grvy + org.codenarc.rule.junit.JUnitUnnecessaryTearDownRule + MAJOR + + + grvy + org.codenarc.rule.junit.JUnitStyleAssertionsRule + MAJOR + + + grvy + org.codenarc.rule.junit.UseAssertEqualsInsteadOfAssertTrueRule + MAJOR + + + grvy + org.codenarc.rule.junit.UseAssertFalseInsteadOfNegationRule + MINOR + + + grvy + org.codenarc.rule.junit.UseAssertTrueInsteadOfAssertEqualsRule + MAJOR + + + grvy + org.codenarc.rule.junit.UseAssertNullInsteadOfAssertEqualsRule + MAJOR + + + grvy + org.codenarc.rule.junit.UseAssertSameInsteadOfAssertTrueRule + MAJOR + + + grvy + org.codenarc.rule.junit.JUnitFailWithoutMessageRule + MINOR + + + grvy + org.codenarc.rule.junit.UseAssertTrueInsteadOfNegationRule + MINOR + + + grvy + org.codenarc.rule.junit.JUnitTestMethodWithoutAssertRule + MINOR + + + grvy + org.codenarc.rule.junit.ChainedTestRule + MINOR + + + grvy + org.codenarc.rule.junit.CoupledTestCaseRule + MINOR + + + grvy + org.codenarc.rule.junit.UnnecessaryFailRule + MINOR + + + grvy + org.codenarc.rule.junit.SpockIgnoreRestUsedRule.fixed + MINOR + + + grvy + org.codenarc.rule.junit.JUnitLostTestRule + MINOR + + + grvy + org.codenarc.rule.junit.JUnitUnnecessaryThrowsExceptionRule + MAJOR + + + grvy + org.codenarc.rule.junit.JUnitPublicFieldRule + MAJOR + + + grvy + org.codenarc.rule.junit.JUnitAssertEqualsConstantActualValueRule + MINOR + + + grvy + org.codenarc.rule.junit.JUnitPublicPropertyRule.fixed + MINOR + + + grvy + org.codenarc.rule.logging.PrintlnRule + MINOR + + + grvy + org.codenarc.rule.logging.PrintStackTraceRule + MINOR + + + grvy + org.codenarc.rule.logging.SystemErrPrintRule + MINOR + + + grvy + org.codenarc.rule.logging.SystemOutPrintRule + MINOR + + + grvy + org.codenarc.rule.logging.LoggerForDifferentClassRule + MINOR + + + grvy + org.codenarc.rule.logging.LoggingSwallowsStacktraceRule + MINOR + + + grvy + org.codenarc.rule.logging.LoggerWithWrongModifiersRule + MINOR + + + grvy + org.codenarc.rule.logging.MultipleLoggersRule + MINOR + + + grvy + org.codenarc.rule.naming.AbstractClassNameRule.fixed + MINOR + + + grvy + org.codenarc.rule.naming.ClassNameRule + MINOR + + + grvy + org.codenarc.rule.naming.FieldNameRule.fixed + MINOR + + + grvy + org.codenarc.rule.naming.InterfaceNameRule.fixed + MINOR + + + grvy + org.codenarc.rule.naming.MethodNameRule.fixed + MINOR + + + grvy + org.codenarc.rule.naming.PackageNameRule + MINOR + + + grvy + org.codenarc.rule.naming.ParameterNameRule.fixed + MINOR + + + grvy + org.codenarc.rule.naming.PropertyNameRule.fixed + MINOR + + + grvy + org.codenarc.rule.naming.VariableNameRule.fixed + MINOR + + + grvy + org.codenarc.rule.naming.ConfusingMethodNameRule + MINOR + + + grvy + org.codenarc.rule.naming.ObjectOverrideMisspelledMethodNameRule + MINOR + + + grvy + org.codenarc.rule.naming.FactoryMethodNameRule + MINOR + + + grvy + org.codenarc.rule.naming.ClassNameSameAsFilenameRule + MINOR + + + grvy + org.codenarc.rule.naming.PackageNameMatchesFilePathRule.fixed + MINOR + + + grvy + org.codenarc.rule.naming.ClassNameSameAsSuperclassRule + MINOR + + + grvy + org.codenarc.rule.naming.InterfaceNameSameAsSuperInterfaceRule + MINOR + + + grvy + org.codenarc.rule.size.ClassSizeRule + MAJOR + + + grvy + org.codenarc.rule.size.CyclomaticComplexityRule.fixed + MINOR + + + grvy + org.codenarc.rule.size.MethodCountRule + MINOR + + + grvy + org.codenarc.rule.size.MethodSizeRule.fixed + MAJOR + + + grvy + org.codenarc.rule.size.NestedBlockDepthRule + MINOR + + + grvy + org.codenarc.rule.size.CrapMetricRule.fixed + MINOR + + + grvy + org.codenarc.rule.size.AbcMetricRule.fixed + MINOR + + + grvy + org.codenarc.rule.size.ParameterCountRule + MINOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryBooleanExpressionRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryIfStatementRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryTernaryExpressionRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryBigDecimalInstantiationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryBigIntegerInstantiationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryBooleanInstantiationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryCallForLastElementRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryCatchBlockRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryCollectCallRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryCollectionCallRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryConstructorRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryDoubleInstantiationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryFloatInstantiationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryGetterRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryGStringRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryInstantiationToGetClassRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryIntegerInstantiationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryLongInstantiationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryObjectReferencesRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryNullCheckRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryNullCheckBeforeInstanceOfRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryOverridingMethodRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryReturnKeywordRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryStringInstantiationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.AddEmptyStringRule + MINOR + + + grvy + org.codenarc.rule.unnecessary.ConsecutiveLiteralAppendsRule + MINOR + + + grvy + org.codenarc.rule.unnecessary.ConsecutiveStringConcatenationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryCallToSubstringRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryDefInMethodDeclarationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryModOneRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryPublicModifierRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessarySelfAssignmentRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessarySemicolonRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryTransientModifierRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryFinalOnPrivateMethodRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryElseStatementRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryParenthesesForMethodCallWithClosureRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryPackageReferenceRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryDefInVariableDeclarationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryDotClassRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryInstanceOfCheckRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessarySubstringRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryDefInFieldDeclarationRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryCastRule + MINOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessaryToStringRule + MINOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessarySafeNavigationOperatorRule + MAJOR + + + grvy + org.codenarc.rule.unnecessary.UnnecessarySetterRule + MAJOR + + + grvy + org.codenarc.rule.unused.UnusedArrayRule + MINOR + + + grvy + org.codenarc.rule.unused.UnusedObjectRule + MINOR + + + grvy + org.codenarc.rule.unused.UnusedPrivateFieldRule + MINOR + + + grvy + org.codenarc.rule.unused.UnusedPrivateMethodRule + MINOR + + + grvy + org.codenarc.rule.unused.UnusedVariableRule.fixed + MINOR grvy - org.codenarc.rule.exceptions.CatchExceptionRule - MAJOR + org.codenarc.rule.unused.UnusedPrivateMethodParameterRule + MINOR grvy - org.codenarc.rule.exceptions.CatchNullPointerExceptionRule - CRITICAL + org.codenarc.rule.unused.UnusedMethodParameterRule + MINOR grvy - org.codenarc.rule.exceptions.CatchRuntimeExceptionRule - CRITICAL + org.codenarc.rule.jdbc.DirectConnectionManagementRule + MINOR grvy - org.codenarc.rule.design.CloneableWithoutCloneRule + org.codenarc.rule.jdbc.JdbcConnectionReferenceRule MINOR grvy - org.codenarc.rule.braces.ElseBlockBracesRule + org.codenarc.rule.jdbc.JdbcResultSetReferenceRule MINOR grvy - org.codenarc.rule.grails.GrailsPublicControllerMethodRule.fixed + org.codenarc.rule.jdbc.JdbcStatementReferenceRule MINOR grvy - org.codenarc.rule.grails.GrailsServletContextReferenceRule + org.codenarc.rule.security.NonFinalSubclassOfSensitiveInterfaceRule + MINOR + + + grvy + org.codenarc.rule.security.InsecureRandomRule + MINOR + + + grvy + org.codenarc.rule.security.FileCreateTempFileRule + MINOR + + + grvy + org.codenarc.rule.security.SystemExitRule + MINOR + + + grvy + org.codenarc.rule.security.ObjectFinalizeRule + MINOR + + + grvy + org.codenarc.rule.security.JavaIoPackageAccessRule + MINOR + + + grvy + org.codenarc.rule.security.UnsafeArrayDeclarationRule + MINOR + + + grvy + org.codenarc.rule.security.PublicFinalizeMethodRule + MINOR + + + grvy + org.codenarc.rule.security.NonFinalPublicFieldRule + MINOR + + + grvy + org.codenarc.rule.security.UnsafeImplementationAsMapRule + MINOR + + + grvy + org.codenarc.rule.formatting.BracesForClassRule + MINOR + + + grvy + org.codenarc.rule.formatting.LineLengthRule + MINOR + + + grvy + org.codenarc.rule.formatting.BracesForForLoopRule + MINOR + + + grvy + org.codenarc.rule.formatting.BracesForIfElseRule + MINOR + + + grvy + org.codenarc.rule.formatting.BracesForMethodRule + MINOR + + + grvy + org.codenarc.rule.formatting.BracesForTryCatchFinallyRule + MINOR + + + grvy + org.codenarc.rule.formatting.ClassJavadocRule MINOR grvy - org.codenarc.rule.grails.GrailsSessionReferenceRule + org.codenarc.rule.formatting.SpaceAfterCommaRule MAJOR grvy - org.codenarc.rule.grails.GrailsStatelessServiceRule + org.codenarc.rule.formatting.SpaceAfterSemicolonRule MAJOR grvy - org.codenarc.rule.size.NestedBlockDepthRule + org.codenarc.rule.formatting.SpaceAroundOperatorRule MAJOR grvy - org.codenarc.rule.concurrency.NestedSynchronizationRule - CRITICAL + org.codenarc.rule.formatting.SpaceBeforeOpeningBraceRule + MAJOR grvy - org.codenarc.rule.logging.PrintStackTraceRule + org.codenarc.rule.formatting.SpaceAfterOpeningBraceRule MAJOR grvy - org.codenarc.rule.logging.PrintlnRule - MINOR + org.codenarc.rule.formatting.SpaceAfterClosingBraceRule + MAJOR grvy - org.codenarc.rule.basic.ReturnFromFinallyBlockRule + org.codenarc.rule.formatting.SpaceBeforeClosingBraceRule MAJOR grvy - org.codenarc.rule.concurrency.SynchronizedMethodRule + org.codenarc.rule.formatting.SpaceAfterIfRule MAJOR grvy - org.codenarc.rule.logging.SystemErrPrintRule + org.codenarc.rule.formatting.SpaceAfterWhileRule MAJOR grvy - org.codenarc.rule.logging.SystemOutPrintRule - INFO + org.codenarc.rule.formatting.SpaceAfterForRule + MAJOR grvy - org.codenarc.rule.concurrency.SystemRunFinalizersOnExitRule + org.codenarc.rule.formatting.SpaceAfterSwitchRule MAJOR grvy - org.codenarc.rule.concurrency.ThreadYieldRule - CRITICAL + org.codenarc.rule.formatting.SpaceAfterCatchRule + MAJOR grvy - org.codenarc.rule.exceptions.ThrowErrorRule + org.codenarc.rule.formatting.SpaceAroundClosureArrowRule MAJOR grvy - org.codenarc.rule.exceptions.ThrowExceptionRule + org.codenarc.rule.formatting.SpaceAroundMapEntryColonRule MAJOR grvy - org.codenarc.rule.basic.ThrowExceptionFromFinallyBlockRule + org.codenarc.rule.formatting.ClosureStatementOnOpeningLineOfMultipleLineClosureRule MAJOR grvy - org.codenarc.rule.exceptions.ThrowNullPointerExceptionRule + org.codenarc.rule.formatting.ConsecutiveBlankLinesRule MAJOR grvy - org.codenarc.rule.exceptions.ThrowRuntimeExceptionRule + org.codenarc.rule.formatting.BlankLineBeforePackageRule MAJOR grvy - org.codenarc.rule.exceptions.ThrowThrowableRule + org.codenarc.rule.formatting.FileEndsWithoutNewlineRule MAJOR grvy - org.codenarc.rule.imports.UnnecessaryGroovyImportRule + org.codenarc.rule.formatting.MissingBlankLineAfterImportsRule MAJOR grvy - org.codenarc.rule.imports.UnusedImportRule + org.codenarc.rule.formatting.MissingBlankLineAfterPackageRule MAJOR grvy - org.codenarc.rule.unused.UnusedPrivateFieldRule + org.codenarc.rule.formatting.TrailingWhitespaceRule MAJOR grvy - org.codenarc.rule.unused.UnusedPrivateMethodRule + org.codenarc.rule.formatting.IndentationRule MAJOR grvy - org.codenarc.rule.unused.UnusedVariableRule.fixed + org.codenarc.rule.formatting.BlockStartsWithBlankLineRule MAJOR grvy - org.codenarc.rule.concurrency.VolatileLongOrDoubleFieldRule + org.codenarc.rule.formatting.BlockEndsWithBlankLineRule MAJOR - - grvy - org.codenarc.rule.basic.DuplicateCaseStatementRule + org.codenarc.rule.convention.InvertedIfElseRule + MAJOR + + + grvy + org.codenarc.rule.convention.ConfusingTernaryRule + MAJOR + + + grvy + org.codenarc.rule.convention.CouldBeElvisRule + MAJOR + + + grvy + org.codenarc.rule.convention.LongLiteralWithLowerCaseLRule MINOR - grvy - org.codenarc.rule.basic.EmptyCatchBlockRule + org.codenarc.rule.convention.ParameterReassignmentRule + MAJOR + + + grvy + org.codenarc.rule.convention.TernaryCouldBeElvisRule + MAJOR + + + grvy + org.codenarc.rule.convention.VectorIsObsoleteRule MINOR - grvy - org.codenarc.rule.basic.EmptyElseBlockRule + org.codenarc.rule.convention.HashtableIsObsoleteRule MINOR - grvy - org.codenarc.rule.basic.EmptyFinallyBlockRule + org.codenarc.rule.convention.IfStatementCouldBeTernaryRule MINOR - grvy - org.codenarc.rule.basic.EmptyForStatementRule + org.codenarc.rule.convention.NoDefRule + MAJOR + + + grvy + org.codenarc.rule.convention.TrailingCommaRule + MAJOR + + + grvy + org.codenarc.rule.convention.NoTabCharacterRule + MAJOR + + + grvy + org.codenarc.rule.convention.CouldBeSwitchStatementRule + MAJOR + + + grvy + org.codenarc.rule.convention.InvertedConditionRule + MAJOR + + + grvy + org.codenarc.rule.convention.MethodReturnTypeRequiredRule + MAJOR + + + grvy + org.codenarc.rule.convention.MethodParameterTypeRequired + MAJOR + + + grvy + org.codenarc.rule.convention.FieldTypeRequiredRule + MAJOR + + + grvy + org.codenarc.rule.convention.VariableTypeRequiredRule + MAJOR + + + grvy + org.codenarc.rule.convention.StaticFieldsBeforeInstanceFieldsRule + MAJOR + + + grvy + org.codenarc.rule.convention.StaticMethodsBeforeInstanceMethodsRule + MAJOR + + + grvy + org.codenarc.rule.convention.PublicMethodsBeforeNonPublicMethodsRule + MAJOR + + + grvy + org.codenarc.rule.convention.NoJavaUtilDateRule MINOR - grvy - org.codenarc.rule.basic.EmptyIfStatementRule + org.codenarc.rule.groovyism.ExplicitArrayListInstantiationRule MINOR - grvy - org.codenarc.rule.basic.EmptyInstanceInitializerRule + org.codenarc.rule.groovyism.ExplicitCallToAndMethodRule MINOR - grvy - org.codenarc.rule.basic.EmptyMethodRule + org.codenarc.rule.groovyism.ExplicitCallToCompareToMethodRule MINOR - grvy - org.codenarc.rule.basic.EmptyStaticInitializerRule + org.codenarc.rule.groovyism.ExplicitCallToDivMethodRule MINOR - grvy - org.codenarc.rule.basic.EmptySwitchStatementRule + org.codenarc.rule.groovyism.ExplicitCallToEqualsMethodRule MINOR - grvy - org.codenarc.rule.basic.EmptySynchronizedStatementRule + org.codenarc.rule.groovyism.ExplicitCallToGetAtMethodRule MINOR - grvy - org.codenarc.rule.basic.EmptyTryBlockRule + org.codenarc.rule.groovyism.ExplicitCallToLeftShiftMethodRule MINOR - grvy - org.codenarc.rule.basic.EmptyWhileStatementRule + org.codenarc.rule.groovyism.ExplicitCallToMinusMethodRule MINOR - grvy - org.codenarc.rule.basic.EqualsAndHashCodeRule + org.codenarc.rule.groovyism.ExplicitCallToMultiplyMethodRule MINOR - grvy - org.codenarc.rule.basic.EqualsOverloadedRule + org.codenarc.rule.groovyism.ExplicitCallToModMethodRule MINOR - grvy - org.codenarc.rule.basic.EmptyClassRule + org.codenarc.rule.groovyism.ExplicitCallToOrMethodRule MINOR - grvy - org.codenarc.rule.imports.DuplicateImportRule - MAJOR + org.codenarc.rule.groovyism.ExplicitCallToPlusMethodRule + MINOR - grvy - org.codenarc.rule.imports.ImportFromSamePackageRule - MAJOR + org.codenarc.rule.groovyism.ExplicitCallToPowerMethodRule + MINOR - grvy - org.codenarc.rule.imports.ImportFromSunPackagesRule + org.codenarc.rule.groovyism.ExplicitCallToRightShiftMethodRule MINOR - grvy - org.codenarc.rule.naming.ClassNameSameAsFilenameRule + org.codenarc.rule.groovyism.ExplicitCallToXorMethodRule MINOR - grvy - org.codenarc.rule.unused.UnusedPrivateMethodParameterRule + org.codenarc.rule.groovyism.ExplicitHashMapInstantiationRule MINOR - grvy - org.codenarc.rule.unused.UnusedMethodParameterRule + org.codenarc.rule.groovyism.ExplicitHashSetInstantiationRule MINOR - grvy - org.codenarc.rule.convention.ConfusingTernaryRule + org.codenarc.rule.groovyism.ExplicitLinkedListInstantiationRule + MINOR + + + grvy + org.codenarc.rule.groovyism.ExplicitStackInstantiationRule + MINOR + + + grvy + org.codenarc.rule.groovyism.ExplicitTreeSetInstantiationRule + MINOR + + + grvy + org.codenarc.rule.groovyism.GStringAsMapKeyRule + MINOR + + + grvy + org.codenarc.rule.groovyism.GroovyLangImmutableRule + MINOR + + + grvy + org.codenarc.rule.groovyism.ExplicitLinkedHashMapInstantiationRule + MINOR + + + grvy + org.codenarc.rule.groovyism.ClosureAsLastMethodParameterRule MAJOR - grvy - org.codenarc.rule.convention.InvertedIfElseRule + org.codenarc.rule.groovyism.AssignCollectionUniqueRule + MINOR + + + grvy + org.codenarc.rule.groovyism.AssignCollectionSortRule + MINOR + + + grvy + org.codenarc.rule.groovyism.ConfusingMultipleReturnsRule + MINOR + + + grvy + org.codenarc.rule.groovyism.GetterMethodCouldBePropertyRule MAJOR - grvy - org.codenarc.rule.convention.VectorIsObsoleteRule + org.codenarc.rule.groovyism.UseCollectManyRule MINOR - grvy - org.codenarc.rule.convention.HashtableIsObsoleteRule + org.codenarc.rule.groovyism.CollectAllIsDeprecatedRule + MINOR + + + grvy + org.codenarc.rule.groovyism.UseCollectNestedRule + MINOR + + + grvy + org.codenarc.rule.groovyism.GStringExpressionWithinStringRule MINOR - - - - - diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml index b3dae61c..0a64eedf 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml @@ -1,4 +1,4 @@ - + @@ -103,7 +103,7 @@ unused ignoreRegex - + ignore|ignored @@ -364,7 +364,7 @@ case 2: break; case 2: break; // violation } - + switch( "test" ) { case "$a": break; case "$a": break; // ok; only flags constant values (not GStrings) @@ -949,7 +949,7 @@ Classes that implement Serializable should define a serialVersionUID. Deserialization uses this number to ensure that a loaded class corresponds exactly to a serialized object. If you don't define serialVersionUID, the system will make one by hashing most of your class's features. Then if you change anything, the UID will change and Java won't let you reload old data.

An example of a missing serialVersionUID:

-    class MyClass imlements Serializable {
+    class MyClass implements Serializable {
         // missing serialVersionUID
     }
 
@@ -2009,10 +2009,10 @@
     class EventListener {
         EventListener(EventPublisher publisher) {
-            publisher.register(this)            
+            publisher.register(this)
             new WorkThread(publisher, this).start()
             new AnotherWorkThread(listener: this)
-        }    
+        }
     }
 
]]>
@@ -2087,6 +2087,7 @@ If you implement a compareTo method then you should also implement the Comparable interface. If you don't then you could possibly get an exception if the Groovy == operator is invoked on your object. This is an issue fixed in Groovy 1.8 but present in previous versions.

+

This rule has a single enhancedMode property which defaults to false. When set to true, this rule will run in enhanced mode and will not produce a violation when a class implements compareTo and extends a class that itself implements Comparable.

Here is an example of code that produces a violation:

     class BadClass {
@@ -2152,7 +2153,8 @@
     MINOR
     
     
-    If a class defines a "void close()" then that class should implement java.io.Closeable. 

+ If a class defines a void close() method then that class should implement java.io.Closeable.

+

This rule has a single enhancedMode property which defaults to false. When set to true, this rule will run in enhanced mode and will not produce a violation when a class implements close and extends a class that itself implements Closeable.

]]>
design @@ -2407,7 +2409,7 @@

Here are a couple references that discuss the problems with using instanceof and the preference for using instead:

* Beware of instanceof operator

* How does one use polymorphism instead of instanceof? (And why?)

-

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

+

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Spec.groovy', 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

Example of violations:

     class MyClass {
@@ -2500,7 +2502,7 @@ for (int i = 0; i < 100; ++i) {
     
      This rule checks for duplicate number literals within the current class. 

Code containing duplicate literals can usually be improved by declaring the as a constant field.

-

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

+

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Spec.groovy', 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

]]>
bug @@ -2518,7 +2520,7 @@ for (int i = 0; i < 100; ++i) { This rule checks for duplicate String literals within the current class.

Code containing duplicate literals can usually be improved by declaring the as a constant field.

-

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

+

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Spec.groovy', 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

]]>
bug @@ -2536,7 +2538,7 @@ for (int i = 0; i < 100; ++i) { This rule checks for duplicate literals within the current class. This rule only checks for s where the keys and values are all constants or literals.

Code containing duplicate literals can usually be improved by declaring the as a constant field.

-

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

+

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Spec.groovy', 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

Examples of violations:

       def var1 = [a:1, b:null, c:Boolean.FALSE, d:'x', e:true]
@@ -2573,8 +2575,9 @@ for (int i = 0; i < 100; ++i) {
     
     
      This rule checks for duplicate  literals within the current class. This rule only checks for s where values are all constants or literals. 

+

List literals within annotations are ignored.

Code containing duplicate literals can usually be improved by declaring the as a constant field.

-

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

+

By default, the rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Spec.groovy', 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'.

Examples of violations:

       def var1 = [1, null, Boolean.FALSE, 'x', true]
@@ -2867,7 +2870,7 @@ for (int i = 0; i < 100; ++i) {
     
     Checks for a specified illegal regular expression within the source code. 

A RuleSet can contain any number of instances of this rule, but each should be configured with a unique rule and , and (optionally) customized and .

-

NOTE: This rule applies to the text contents of an entire rather than a specific , so it does not support the and configuration properties.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug @@ -2883,7 +2886,7 @@ for (int i = 0; i < 100; ++i) { Checks for a specified regular expression that must exist within the source code.

A RuleSet can contain any number of instances of this rule, but each should be configured with a unique rule and , and (optionally) customized and .

-

NOTE: This rule applies to the text contents of an entire rather than a specific , so it does not support the and configuration properties.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug @@ -2899,7 +2902,7 @@ for (int i = 0; i < 100; ++i) { Checks for a specified text string that must exist within the source code.

A RuleSet can contain any number of instances of this rule, but each should be configured with a unique rule and , and (optionally) customized and .

-

NOTE: This rule applies to the text contents of an entire rather than a specific , so it does not support the and configuration properties.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug @@ -3057,7 +3060,7 @@ for (int i = 0; i < 100; ++i) { Checks for a specified illegal string within the source code.

A RuleSet can contain any number of instances of this rule, but each should be configured with a unique rule and , and (optionally) customized and .

-

NOTE: This rule applies to the text contents of an entire rather than a specific , so it does not support the and configuration properties.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug @@ -3101,27 +3104,13 @@ for (int i = 0; i < 100; ++i) { - - org.codenarc.rule.grails.GrailsSessionReferenceRule - MINOR - - - Rule that checks for references to the session object from within Grails controller and taglib classes.

-

This rule is intended as a "governance" rule to enable monitoring and controlling access to the session from within application source code. Storing objects in the session may inhibit scalability and/or performance and should be carefully considered.

-

Note that this rule does not check for direct access to the session from within GSP (Groovy Server Pages) files.

-

Enabling this rule may make most sense in a team environment where team members exhibit a broad range of skill and experience levels. Appropriate session access can be configured as exceptions to this rule by configuring either the doNotApplyToFilenames or doNotApplyToFilesMatching property of the rule. And, as always, it is easy to just turn off the rule if it does not make sense it your environment.

-

This rule sets the default value of applyToFilesMatching to only match files under the 'grails-app/controllers' or 'grails-app/taglib' folders. You can override this with a different regular expression value if appropriate.

- ]]>
- grails -
- org.codenarc.rule.grails.GrailsServletContextReferenceRule MINOR Rule that checks for references to the servletContext object from within Grails controller and taglib classes.

-

This rule is intended as a "governance" rule to enable monitoring and controlling access to the servletContext from within application source code. Storing objects in the servletContext may inhibit scalability and/or performance and should be carefully considered. Furthermore, access to the servletContext is not synchronized, so reading/writing objects from the servletConext must be manually synchronized, as described in The Definitive Guide to Grails (2nd edition).

+

This rule is intended as a "governance" rule to enable monitoring and controlling access to the servletContext from within application source code. Storing objects in the servletContext may inhibit scalability and/or performance and should be carefully considered. Furthermore, access to the servletContext is not synchronized, so reading/writing objects from the servletContext must be manually synchronized, as described in The Definitive Guide to Grails (2nd edition).

Note that this rule does not check for direct access to the servletContext from within GSP (Groovy Server Pages) files.

Enabling this rule may make most sense in a team environment where team members exhibit a broad range of skill and experience levels. Appropriate servletContext access can be configured as exceptions to this rule by configuring either the doNotApplyToFilenames or doNotApplyToFilesMatching property of the rule. And, as always, it is easy to just turn off the rule if it does not make sense it your environment.

This rule sets the default value of applyToFilesMatching to only match files under the 'grails-app/controllers' or 'grails-app/taglib' folders. You can override this with a different regular expression value if appropriate.

@@ -3232,7 +3221,7 @@ for (int i = 0; i < 100; ++i) { Forbids usage of SQL reserved keywords as class or field names in Grails domain classes. Naming a domain class (or its field) with such a keyword causes SQL schema creation errors and/or redundant table/column name mappings.

Note: due to limited type information available during CodeNarc's operation, this rule will report fields of type java.io.Serializable, but not of its implementations. Please specify any implementations used as domain properties in additionalHibernateBasicTypes.

-]]>
+ ]]>
grails additionalHibernateBasicTypes @@ -3278,6 +3267,48 @@ for (int i = 0; i < 100; ++i) { grails
+ + + org.codenarc.rule.grails.GrailsDomainStringPropertyMaxSizeRule + MINOR + + + String properties in Grails domain classes have to define maximum size otherwise the property is mapped to VARCHAR(255) causing runtime exceptions to occur. To fix this issue either declare size or maxSize constraint for the property inside constraints DSL closure of your Grails domain class or declare the type of the property inside mapping DSL closure. If you use the second option inside mapping DSL closure then please pay attention that the value of type is not checked so using for example VARCHAR(50) would still cause runtime exceptions.

+

Example of violations:

+
+    // both firstName and lastName will probably have database limit of 255 characters
+    // which is not validated by Grails validation causing runtime JDBC exception
+    class Person {
+
+        String firstName
+        String lastName
+
+        static constraints = {
+            firstName nullable:true
+            lastName nullable:true
+        }
+    }
+
+
+    class Person {
+
+        String firstName
+        String lastName
+
+        static constraints = {
+            firstName nullable:true, maxSize: 255
+            lastName nullable:true
+        }
+
+        static mapping = {
+            lastName type: 'text'
+        }
+    }
+
+]]>
+ grails +
+ @@ -3286,6 +3317,7 @@ for (int i = 0; i < 100; ++i) { Checks for a duplicate statements.

+

NOTE: This is a file-based rule, rather than a typical AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug
@@ -3296,6 +3328,7 @@ for (int i = 0; i < 100; ++i) { Checks for an of a class that is within the same package as the importing class.

+

NOTE: This is a file-based rule, rather than a typical AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug @@ -3306,6 +3339,7 @@ for (int i = 0; i < 100; ++i) { Checks for an from any package that is already automatically imported for Groovy files. A Groovy file does not need to include an import for classes from , , , , and , as well as the classes and .

+

NOTE: This is a file-based rule, rather than a typical AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug @@ -3356,11 +3390,6 @@ for (int i = 0; i < 100; ++i) {
]]>
bug - - comesBefore - - true - @@ -3369,16 +3398,26 @@ for (int i = 0; i < 100; ++i) { MAJOR - Wildcard imports, static or otherwise, should not be used.

+ Checks for wildcard (star) imports. If the property is , then do not check static imports. Similarly, do not check the standard imports if ignoreImports is .

Example of violations:

-    import my.something.*
-    import static foo.bar.*
+    import static foo.bar.*         // violation (unless ignoreStaticImports is true)
+    import my.something.*           // violation (unless ignoreImports is true)
 
     public class MyClass{}
 
]]>
bug + + ignoreImports + , then do not check imports. ]]> + false + + + ignoreStaticImports + , then do not check static imports. ]]> + false + @@ -3420,7 +3459,8 @@ for (int i = 0; i < 100; ++i) { Rule that checks that if the JUnit setUp method is defined, that it includes a call to super.setUp().

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule ignored methods annotated with @Before or @BeforeClass.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

]]>
junit @@ -3431,7 +3471,8 @@ for (int i = 0; i < 100; ++i) { Rule that checks that if the JUnit tearDown method is defined, that it includes a call to super.tearDown().

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule ignored methods annotated with @After or @AfterClass.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

]]>
junit @@ -3442,7 +3483,7 @@ for (int i = 0; i < 100; ++i) { Rule that checks checks for JUnit setUp() methods that contain only a call to super.setUp(). The method is then unnecessary.

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

Here is an example of a violation:

     class MyTest extends TestCase {
@@ -3461,7 +3502,7 @@ for (int i = 0; i < 100; ++i) {
     
     
     Rule that checks checks for JUnit tearDown() methods that contain only a call to super.tearDown(). The method is then unnecessary. 

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

Here is an example of a violation:

     class MyTest extends TestCase {
@@ -3492,7 +3533,7 @@ for (int i = 0; i < 100; ++i) {
     
     
     This rule detects JUnit assertions in object equality. These assertions should be made by more specific methods, like assertEquals. 

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

]]>
junit @@ -3504,7 +3545,7 @@ for (int i = 0; i < 100; ++i) { In unit tests, if a condition is expected to be false then there is no sense using assertTrue with the negation operator. For instance, assertTrue(!condition) can always be simplified to assertFalse(condition).

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

]]>
junit @@ -3516,7 +3557,7 @@ for (int i = 0; i < 100; ++i) { This rule detects JUnit calling assertEquals where the first parameter is a boolean. These assertions should be made by more specific methods, like assertTrue or assertFalse.

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

All of the following examples can be simplified to assertTrue or remove the true literal:

     assertEquals(true, foo())
@@ -3549,7 +3590,7 @@ for (int i = 0; i < 100; ++i) {
     
     
     This rule detects JUnit calling assertEquals where the first or second parameter is null. These assertion should be made against the assertNull method instead. 

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

]]>
junit @@ -3561,7 +3602,7 @@ for (int i = 0; i < 100; ++i) { This rule detects JUnit calling assertTrue or assertFalse where the first or second parameter is an Object#is() call testing for reference equality. These assertion should be made against the assertSame or assertNotSame method instead.

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

]]>
junit @@ -3584,7 +3625,7 @@ for (int i = 0; i < 100; ++i) { In unit tests, if a condition is expected to be true then there is no sense using assertFalse with the negation operator. For instance, assertFalse(!condition) can always be simplified to assertTrue(condition).

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

]]>
junit @@ -3674,7 +3715,7 @@ for (int i = 0; i < 100; ++i) { In a unit test, catching an exception and immediately calling Assert.fail() is pointless and hides the stack trace. It is better to rethrow the exception or not catch the exception at all.

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

Example of violations:

     public void testSomething() {
@@ -3741,7 +3782,7 @@ for (int i = 0; i < 100; ++i) {
     
     This rule checks for classes that import JUnit 4 classes and contain a public, instance, void, no-arg method named * that is not annotated with the JUnit 4 @Test annotation. 

Note: This rule should be disabled for Grails 2.x projects, since the Grails test framework can use AST Transformations to automatically annotate test methods.

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

Example of violations:

     import org.junit.Test
@@ -3761,7 +3802,7 @@ for (int i = 0; i < 100; ++i) {
     
     
      Check for throws clauses on JUnit test methods. That is not necessary in Groovy. 

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

Example of violations:

     @Test
@@ -3791,7 +3832,7 @@ for (int i = 0; i < 100; ++i) {
     
     Checks for public fields on a JUnit test class.  There is usually no reason to have a public field (even a constant) on a test class. 

Fields within interfaces and fields annotated with @Rule are ignored.

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

Example of violations:

     import org.junit.Test
@@ -3833,7 +3874,7 @@ for (int i = 0; i < 100; ++i) {
     
     
     Checks for public properties defined on JUnit test classes. There is typically no need to expose a public property (with public  and  methods) on a test class. 

-

This rule sets the default value of the property to only match class names ending in 'Test', 'Tests' or 'TestCase'.

+

This rule sets the default value of the property to only match class names ending in 'Spec', 'Test', 'Tests' or 'TestCase'.

Example of violations:

     import org.junit.Test
@@ -3971,7 +4012,7 @@ for (int i = 0; i < 100; ++i) {
     
       regex
       
-      ([A-Z]\w*\$?)*
+      ([A-Z]\\w*\\$?)*
     
   
 
@@ -4039,7 +4080,7 @@ for (int i = 0; i < 100; ++i) {
     
       regex
       
-      [a-z]\w*
+      [a-z]\\w*
     
   
 
@@ -4059,7 +4100,7 @@ for (int i = 0; i < 100; ++i) {
     
       regex
       
-      [a-z]+[a-z0-9]*(\.[a-z0-9]+)*
+      [a-z]+[a-z0-9]*(\\.[a-z0-9]+)*
     
   
 
@@ -4252,6 +4293,7 @@ for (int i = 0; i < 100; ++i) {
     
     
     Reports files containing only one top level class / enum / interface which is named differently than the file. 

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug @@ -4263,6 +4305,7 @@ for (int i = 0; i < 100; ++i) { A package source file's path should match the package declaration.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
bug @@ -4514,6 +4557,10 @@ for (int i = 0; i < 100; ++i) { void someMethod(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { // violation } + @Override + void someMethod(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7) { // no violation if ignoreOverriddenMethods == true + } + class SampleClass { SampleClass(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7) { // violation } @@ -4521,6 +4568,11 @@ for (int i = 0; i < 100; ++i) {
]]>
bug + + ignoreOverriddenMethods + + true + maxParameters @@ -4808,6 +4860,11 @@ for (int i = 0; i < 100; ++i) {
]]>
clumsy + + ignoreAnnotations + + false + @@ -5260,6 +5317,7 @@ for (int i = 0; i < 100; ++i) { The 'public' modifier is not required on methods, constructors or classes.

+

Because of Groovy parsing limitations, this rule ignores methods (and constructors) that include Generic types in the method declaration.

Example of violations:

     // violation on class
@@ -5644,6 +5702,31 @@ for (int i = 0; i < 100; ++i) {
     clumsy
   
 
+  
+  
+    org.codenarc.rule.unnecessary.UnnecessarySetterRule
+    MAJOR
+    
+    
+    Checks for explicit calls to setter methods which can, for the most part, be replaced by assignment to property. A setter is defined as a method call that matches set[A-Z] but not set[A-Z][A-Z] such as setURL(). Setters take one method argument. Setter calls within an expression are ignored. 

+

These bits of code produce violations:

+
+  x.setProperty(1)
+  x.setProperty(this.getA())
+  x.setProperty([])
+
+
+  x.set(1)                              // Nothing after "set"
+  x.setup(2)                            // The letter after "set" must be capitalized
+  x.setURL('')                          // But setters with multiple capital letters after "set" are ignored
+  x.setSomething('arg1', 'arg2')        // Setter must have exactly one argument
+  if (!file.setExecutable(true)) { }    // Set method called within expression
+  def count = x.setCount(92)            // Set method called within expression
+
+]]>
+ clumsy +
+ @@ -5680,7 +5763,7 @@ for (int i = 0; i < 100; ++i) { Checks for object allocations that are not assigned or used, unless it is the last statement within a block (because it may be the intentional return value). Examples include:

-

By default, this rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Test.groovy', 'Tests.groovy' or 'TestCase.groovy'. Invoking constructors without using the result is a common pattern in tests.

+

By default, this rule does not analyze test files. This rule sets the default value of the property to ignore file names ending in 'Spec.groovy, ''Test.groovy', 'Tests.groovy' or 'TestCase.groovy'. Invoking constructors without using the result is a common pattern in tests.

     int myMethod() {
         new BigDecimal("23.45")     // unused
@@ -5708,7 +5791,8 @@ for (int i = 0; i < 100; ++i) {
     MINOR
     
     
-    Checks for private fields that are not referenced within the same class. Note that the private modifier is not currently "respected" by Groovy code (i.e., Groovy can access private members within other classes). By default, fields named serialVersionUID are ignored. The rule has a property named ignoreFieldNames, which can be set to ignore other field names as well. For instance, to ignore fields named 'fieldx', set the property to the 'fieldx, serialVersionUID' 

+ Checks for private fields that are not referenced within the same class. Note that the private modifier is not currently "respected" by Groovy code (i.e., Groovy can access private members within other classes).

+

By default, fields named serialVersionUID, and fields annotated with groovy.lang.Delegate are ignored. The rule has a property named , which can be set to ignore other field names as well. For instance, to also ignore fields named 'fieldx', set the property to the 'fieldx, serialVersionUID'

Known limitations:

]]>
bug @@ -5728,6 +5812,10 @@ for (int i = 0; i < 100; ++i) {

Known limitations:

]]>
bug + + ignoreMethodsWithAnnotationNames + + @@ -5735,7 +5823,7 @@ for (int i = 0; i < 100; ++i) { MINOR - Checks for variables that are never referenced.

+ Checks for variables that are never referenced. An assignment to the variable is not considered a reference.

The rule has a property named ignoreVariableNames, which can be set to ignore some variable names. For instance, to ignore fields named 'unused', set the property to 'unused'.

Known limitations:

]]>
@@ -5894,7 +5982,7 @@ for (int i = 0; i < 100; ++i) { The File.createTempFile() method is insecure, and has been deprecated by the ESAPI secure coding library. It has been replaced by the ESAPI Randomizer.getRandomFilename(String) method.

-

For more information see the ESAPI website and the Randomizer Javadoc.

+

For more information see the ESAPI website: http://code.google.com/p/owasp-esapi-java/ and the Randomizer Javadoc: http://owasp-esapi-java.googlecode.com/svn/trunk_doc/latest/org/owasp/esapi/Randomizer.html

]]>
bug
@@ -6037,6 +6125,7 @@ for (int i = 0; i < 100; ++i) { Checks the location of the opening brace (\{) for classes. By default, requires them on the same line, but the sameLine property can be set to false to override this.

NOTE: This rule ignores annotation types, e.g. @interface MyAnnotation {}.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
convention @@ -6103,12 +6192,12 @@ for (int i = 0; i < 100; ++i) { elseOnSameLineAsClosingBrace - true + the same as sameLine elseOnSameLineAsOpeningBrace - true + the same as sameLine sameLine @@ -6159,6 +6248,7 @@ for (int i = 0; i < 100; ++i) { Makes sure each class and interface definition is preceded by javadoc. Enum definitions are not checked, due to strange behavior in the Groovy AST. By default, only the main class in a file is checked for Javadoc. The main class is defined as the class that has the same name as the source file, for instance MyClass is the main class in MyClass.groovy but the class MyOtherClass defined in the same source file is not the main class. To check all the classes in the file set the rule property applyToNonMainClasses to true.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
convention @@ -6197,6 +6287,11 @@ for (int i = 0; i < 100; ++i) {

Known limitations:

]]> convention + + ignoreParameterDefaultValueAssignments + + true + @@ -6206,12 +6301,13 @@ for (int i = 0; i < 100; ++i) { Check that there is at least one space (blank) or whitespace before each opening brace ("\{") for method/class/interface declarations, closure expressions and block statements.

+

A closure expression a preceded by an opening parenthesis, an opening square brace ([), or a dollar sign ($) within a GString does not cause a violation.

Known limitations:

]]>
convention checkClosureMapEntryValue - + true @@ -6258,12 +6354,12 @@ for (int i = 0; i < 100; ++i) { convention checkClosureMapEntryValue - + true ignoreEmptyBlock - + false @@ -6275,13 +6371,13 @@ for (int i = 0; i < 100; ++i) { Check that there is at least one space (blank) or whitespace after each closing brace ("\{") for method/class/interface declarations, closure expressions and block statements.

-

A closure expression followed by a dot operator (.), a comma, a closing parenthesis, the spread-dot operator (*.), a semicolon or the null-safe operator (?.) does not cause a violation.

+

A closure expression followed by a dot operator (.), a comma, a closing parenthesis, a closing square brace (]), the spread-dot operator (*.), a semicolon or the null-safe operator (?.) does not cause a violation.

Known limitations:

]]>
convention checkClosureMapEntryValue - + true @@ -6298,12 +6394,12 @@ for (int i = 0; i < 100; ++i) { convention checkClosureMapEntryValue - + true ignoreEmptyBlock - + false @@ -6477,6 +6573,7 @@ for (int i = 0; i < 100; ++i) { Makes sure there are no blank lines before the package declaration of a source code file.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
convention @@ -6488,6 +6585,7 @@ for (int i = 0; i < 100; ++i) { Makes sure each source file ends with a newline character.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

]]>
convention @@ -6535,6 +6633,154 @@ for (int i = 0; i < 100; ++i) { Checks that no lines of source code end with whitespace characters.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

+]]>
+ convention + + + + + org.codenarc.rule.formatting.IndentationRule + MAJOR + + + Check the indentation (spaces only; not tabs) for class, field and method declarations, and statements.

+

This rule is limited, and somewhat opinionated. The default is 4 spaces per indentation level.

+

Known Limitations include:

+]]>
+ convention + + spacesPerIndentLevel + + 4 + +
+ + + + org.codenarc.rule.formatting.BlockStartsWithBlankLineRule + MAJOR + + + Checks that code blocks such as method bodies, closures and control structure bodies do not start with an empty line.

+

Example of violations:

+
+    boolean not(boolean value) {
+                                // violation
+        !value
+    }
+
+    3.times {
+                                // violation
+        println 'hello!'
+    }
+
+    for (value in []) {
+                                // violation
+        println value
+    }
+
+    for (i = 0; i < 3; i++) {
+                                // violation
+        println i
+    }
+
+    int j = 0
+    while (j < 3) {
+                                // violation
+      println j++
+    }
+
+    if (ready) {
+                                // violation
+        println 'ready'
+    } else {
+                                // violation
+        println 'not ready'
+    }
+
+    try {
+                                // violation
+        throw new Exception()
+    } catch (Exception e) {
+                                // violation
+        println 'exception'
+    } finally {
+                                // violation
+        println 'finally'
+    }
+
+    switch (true) {
+                                // violation
+        default:
+            println 'switch'
+    }
+
+
+]]>
+ convention +
+ + + + org.codenarc.rule.formatting.BlockEndsWithBlankLineRule + MAJOR + + + Checks that code blocks such as method bodies, closures and control structure bodies do not end with an empty line.

+

Example of violations:

+
+    boolean not(boolean value) {
+        !value
+                                // violation
+    }
+
+    3.times {
+        println 'hello!'
+                                // violation
+    }
+
+    for (value in []) {
+        println value
+                                // violation
+    }
+
+    for (i = 0; i < 3; i++) {
+        println i
+                                // violation
+    }
+
+    int j = 0
+    while (j < 3) {
+      println j++
+                                // violation
+    }
+
+    if (ready) {
+        println 'ready'
+                                // violation
+    } else {
+        println 'not ready'
+                                // violation
+    }
+
+    try {
+        throw new Exception()
+                                // violation
+    } catch (Exception e) {
+        println 'exception'
+                                // violation
+    } finally {
+        println 'finally'
+                                // violation
+    }
+
+    switch (true) {
+        default:
+            println 'switch'
+                                // violation
+    }
+
]]>
convention
@@ -6722,8 +6968,7 @@ for (int i = 0; i < 100; ++i) { Do not allow using the def keyword in code. Use a specific type instead.

-

NOTE: This rule applies to the text contents of a rather than a specific , so it does not support the and configuration properties.

-]]>
+ ]]> bug excludeRegex @@ -6775,6 +7020,271 @@ for (int i = 0; i < 100; ++i) { Checks that all source files do not contain the tab character.

+

NOTE: This is a file-based rule, rather than an AST-based rule, so the and rule configuration properties are not available. See Standard Properties for Configuring Rules.

+ ]]>
+ bug + + + + + org.codenarc.rule.convention.CouldBeSwitchStatementRule + MAJOR + + + Checks for three of more if statements that could be converted to a switch. Only applies to equality and instanceof.

+

Example of violations:

+
+    if (x == 1) {                       // violation
+       y = x
+    } else if (x == 2) {
+       y = x * 2
+    } else if (x == 3) {
+       y = x * 3
+    } else {
+       y = 0
+    }
+
+    if (y instanceof Integer) {         // violation
+       x = y + 1
+    }
+    if (y instanceof String) {
+       x = y + '1'
+    } else if (y instanceof Boolean) {
+       x = !y
+    } else {
+       x = null
+    }
+
+    if (x == 1) {                       // OK
+        y = x
+    }
+    if (x == 2) {
+        y = x * 2
+    } else {
+        y = 0
+    }
+
+    if (!x && y) {                      // OK
+        doSomething()
+    } else if (!x && z) {
+        doSomethingElse()
+    } else if (!x && i) {
+        doAnotherThing()
+    }
+
+
+]]>
+ bug +
+ + + + org.codenarc.rule.convention.InvertedConditionRule + MAJOR + + + An inverted condition is one where a constant expression is used on the left hand side of the equals comparision. Such conditions can be confusing especially when used in assertions where the expected value is by convention placed on the right hand side of the comparision.

+

Example of violations:

+
+    boolean isTenCharactersLong(String value) {
+        10 == value.size()  // violation
+    }
+
+]]>
+ bug +
+ + + + org.codenarc.rule.convention.MethodReturnTypeRequiredRule + MAJOR + + + Checks that method return types are not dynamic, that is they are explicitly stated and different than def.

+

Example of violations:

+
+    def methodWithDynamicReturnType() {    // violation
+    }
+
+    private methodWithoutReturnType() {    // violation
+    }
+
+    Object objectReturningMethod() {       // OK
+    }
+
+]]>
+ bug +
+ + + + org.codenarc.rule.convention.MethodParameterTypeRequired + MAJOR + + + Checks that method parameters are not dynamically typed, that is they are explicitly stated and different than def.

+

Example of violations:

+
+    void methodWithDynamicParameter(def parameter) {              // violation
+    }
+
+    void methodWithParameterWithoutTypeDeclaration(parameter) {   // violation
+    }
+
+    void methodWithObjectParameter(Object parameter)              // OK
+
+]]>
+ bug +
+ + + + org.codenarc.rule.convention.FieldTypeRequiredRule + MAJOR + + + Checks that field types are explicitly specified (and not using def).

+

Example of violations:

+
+    class MyClass {
+        public static final NAME = "joe"        // violation
+        private static count = 0                // violation
+
+        private def name = NAME                 // violation
+        protected final date = new Date()       // violation
+
+        def defaultName                         // violation
+        def maxSoFar = -1L                      // violation
+    }
+
+]]>
+ bug + + ignoreFieldNames + + +
+ + + + org.codenarc.rule.convention.VariableTypeRequiredRule + MAJOR + + + Checks that variable types are explicitly specified in declarations (and not using def).

+

Example of violations:

+
+    class MyClass {
+        void doStuff() {
+            final NAME = "joe"          // violation
+            def count = 0, max = 99     // violation
+            def defaultName             // violation
+        }
+    }
+
+]]>
+ bug + + ignoreVariableNames + + +
+ + + + org.codenarc.rule.convention.StaticFieldsBeforeInstanceFieldsRule + MAJOR + + + Enforce that all static fields are above all instance fields within a class

+

Example of violations:

+
+    class MyClass {
+        public static final int COUNT = 99
+
+        public String f1
+
+        public static final String F1 = "xxx"       // violation
+        private static String F4                    // violation
+        static F5 = new Date()                      // violation
+
+        protected String f2
+    }
+
+]]>
+ bug +
+ + + + org.codenarc.rule.convention.StaticMethodsBeforeInstanceMethodsRule + MAJOR + + + Enforce that all static methods within each visibility level (public, protected, private) are above all instance methods within that same visibility level. In other words, public static methods must be above public instance methods, protected static methods must be above protected instance methods and private static methods must be above private instance methods.

+

Example of violations:

+
+        class MyClass {
+            // Public
+            public static int staticMethod1() { }
+            public String method1() { }
+            int method2() { }
+            static final String staticMethod2(int id) { }       // violation
+
+            // Protected
+            protected String method3() { }
+            protected static staticMethod3() { }                // violation
+
+            // Private
+            private int method4() { }
+            private int method5() { }
+            private static staticMethod4() { }                  // violation
+            private String method5() { }
+        }
+    }
+
+]]>
+ bug +
+ + + + org.codenarc.rule.convention.PublicMethodsBeforeNonPublicMethodsRule + MAJOR + + + Enforce that all public methods are above protected and private methods.

+

Example of violations:

+
+    class MyClass {
+        public static int staticMethod1() { }
+
+        protected String method1() { }
+
+        static final String staticMethod2() { }     // violation
+        public String method2() { }                 // violation
+
+        private int method3(int id) { }
+    }
+
+]]>
+ bug +
+ + + + org.codenarc.rule.convention.NoJavaUtilDateRule + MINOR + + + Do not use the java.util.Date class. Prefer the classes in the java.time.* packages. This rule checks for construction of new java.util.Date objects.

+

If the class imports another Date class, then references to new Date() will not cause a violation.

+

Example of violations:

+
+    def timestamp = new Date()              // violation
+    Date myDate = new java.util.Date()      // violation
+    Date startTime = new Date(123456789L)   // violation
+
]]>
bug
@@ -7046,31 +7556,37 @@ for (int i = 0; i < 100; ++i) { The groovy.lang.Immutable annotation has been deprecated and replaced by groovy.transform.Immutable. Do not use the Immutable in groovy.lang.

Example of violations:

-    @Immutable
+    @Immutable                          // Violation (no import means groovy.lang.Immutable)
     class Person { }
 
-    @groovy.lang.Immutable
+    @groovy.lang.Immutable              // Violation
     class Person { }
 
     import groovy.lang.Immutable as Imtl
-    @Imtl
+    @Imtl                               // Violation
     class Person { }
 
-    // the following code is OK
-    @groovy.transform.Immutable
+
+
+
+    @groovy.transform.Immutable                 // OK
     class Person { }
 
-    import groovy.transform.Immutable
+    import groovy.transform.Immutable           // OK
     @Immutable
     class Person { }
 
     import groovy.transform.*
-    @Immutable
+    @Immutable                                  // OK
     class Person { }
 
     import groovy.transform.Immutable as Imtl
-    @Imtl
+    @Imtl                                       // OK
     class Person { }
+
+    @javax.annotation.concurrent.Immutable      // OK
+    class MyClass { }
+
 
]]>
groovyism @@ -7210,6 +7726,11 @@ def (f, g) = [1, 2] // ok
]]>
groovyism + + ignoreMethodsWithOverrideAnnotation + + false +
From cfbb4871c1d845647e86f1847b09b83949f1545d Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Wed, 31 Oct 2018 16:14:08 +0100 Subject: [PATCH 03/14] added new rules --- .../plugins/groovy/codenarc/Converter.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tools/sonar-codenarc-converter/src/main/java/org/sonar/plugins/groovy/codenarc/Converter.java b/tools/sonar-codenarc-converter/src/main/java/org/sonar/plugins/groovy/codenarc/Converter.java index 2303fd21..8683f467 100644 --- a/tools/sonar-codenarc-converter/src/main/java/org/sonar/plugins/groovy/codenarc/Converter.java +++ b/tools/sonar-codenarc-converter/src/main/java/org/sonar/plugins/groovy/codenarc/Converter.java @@ -123,7 +123,7 @@ public static Multimap loadRules() throws Exception { org.codenarc.rule.imports.UnnecessaryGroovyImportRule.class, org.codenarc.rule.imports.UnusedImportRule.class, org.codenarc.rule.grails.GrailsPublicControllerMethodRule.class, - org.codenarc.rule.grails.GrailsSessionReferenceRule.class, + // org.codenarc.rule.grails.GrailsSessionReferenceRule.class, - deprecated in 0.9 org.codenarc.rule.grails.GrailsServletContextReferenceRule.class, org.codenarc.rule.grails.GrailsStatelessServiceRule.class, org.codenarc.rule.generic.IllegalRegexRule.class, @@ -473,6 +473,28 @@ public static Multimap loadRules() throws Exception { org.codenarc.rule.convention.TrailingCommaRule.class, org.codenarc.rule.convention.NoTabCharacterRule.class); + insertRules(rules, "1.0", props, parametersByRule, + org.codenarc.rule.convention.CouldBeSwitchStatementRule.class, + org.codenarc.rule.unnecessary.UnnecessarySetterRule.class); + + insertRules(rules, "1.1", props, parametersByRule, + org.codenarc.rule.enhanced.MissingOverrideAnnotationRule.class, + org.codenarc.rule.formatting.IndentationRule.class, + org.codenarc.rule.convention.InvertedConditionRule.class, + org.codenarc.rule.convention.MethodReturnTypeRequiredRule.class, + org.codenarc.rule.convention.MethodParameterTypeRequired.class, + org.codenarc.rule.convention.FieldTypeRequiredRule.class, + org.codenarc.rule.convention.VariableTypeRequiredRule.class, + org.codenarc.rule.formatting.BlockStartsWithBlankLineRule.class, + org.codenarc.rule.formatting.BlockEndsWithBlankLineRule.class); + + insertRules(rules, "1.2", props, parametersByRule, + org.codenarc.rule.convention.StaticFieldsBeforeInstanceFieldsRule.class, + org.codenarc.rule.convention.StaticMethodsBeforeInstanceMethodsRule.class, + org.codenarc.rule.convention.PublicMethodsBeforeNonPublicMethodsRule.class, + org.codenarc.rule.grails.GrailsDomainStringPropertyMaxSizeRule.class, + org.codenarc.rule.convention.NoJavaUtilDateRule.class); + return rules; } From 3f44502ceaff31d0da9a8ddc36bb5e913e1e5e24 Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Wed, 31 Oct 2018 16:14:25 +0100 Subject: [PATCH 04/14] bumped version --- groovy-jacoco-previous/pom.xml | 2 +- pom.xml | 2 +- sonar-groovy-plugin/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/groovy-jacoco-previous/pom.xml b/groovy-jacoco-previous/pom.xml index 28a26023..a86f6add 100644 --- a/groovy-jacoco-previous/pom.xml +++ b/groovy-jacoco-previous/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC2 + 1.6-RC3 groovy-jacoco-previous diff --git a/pom.xml b/pom.xml index 5eb61d73..273af15a 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.sonarsource.groovy groovy - 1.6-RC2 + 1.6-RC3 pom Sonar Groovy diff --git a/sonar-groovy-plugin/pom.xml b/sonar-groovy-plugin/pom.xml index 9eca05ba..af25e49f 100644 --- a/sonar-groovy-plugin/pom.xml +++ b/sonar-groovy-plugin/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC2 + 1.6-RC3 sonar-groovy-plugin From ae021e4d6148a1b1bb87b933da244daf41cf78ab Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Wed, 31 Oct 2018 16:23:53 +0100 Subject: [PATCH 05/14] fixed tests and costs --- .../resources/org/sonar/plugins/groovy/cost.csv | 15 +++++++++++++++ .../codenarc/CodeNarcRulesDefinitionTest.java | 2 +- .../groovy/codenarc/SonarWayProfileTest.java | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/cost.csv b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/cost.csv index 51e8c27e..d3808337 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/cost.csv +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/cost.csv @@ -345,3 +345,18 @@ org.codenarc.rule.unused.UnusedPrivateFieldRule;linear;5min org.codenarc.rule.unused.UnusedPrivateMethodParameterRule;linear;5min org.codenarc.rule.unused.UnusedPrivateMethodRule;linear;5min org.codenarc.rule.unused.UnusedVariableRule.fixed;linear;5min +org.codenarc.rule.convention.InvertedConditionRule;linear;5min +org.codenarc.rule.convention.StaticFieldsBeforeInstanceFieldsRule;linear;5min +org.codenarc.rule.convention.FieldTypeRequiredRule;linear;5min +org.codenarc.rule.convention.StaticMethodsBeforeInstanceMethodsRule;linear;5min +org.codenarc.rule.convention.MethodParameterTypeRequired;linear;5min +org.codenarc.rule.convention.NoJavaUtilDateRule;linear;5min +org.codenarc.rule.formatting.IndentationRule;linear;5min +org.codenarc.rule.unnecessary.UnnecessarySetterRule;linear;5min +org.codenarc.rule.grails.GrailsDomainStringPropertyMaxSizeRule;linear;5min +org.codenarc.rule.convention.CouldBeSwitchStatementRule;linear;5min +org.codenarc.rule.convention.MethodReturnTypeRequiredRule;linear;5min +org.codenarc.rule.formatting.BlockEndsWithBlankLineRule;linear;5min +org.codenarc.rule.formatting.BlockStartsWithBlankLineRule;linear;5min +org.codenarc.rule.convention.VariableTypeRequiredRule;linear;5min +org.codenarc.rule.convention.PublicMethodsBeforeNonPublicMethodsRule;linear;5min diff --git a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/CodeNarcRulesDefinitionTest.java b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/CodeNarcRulesDefinitionTest.java index eda52e27..50334975 100644 --- a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/CodeNarcRulesDefinitionTest.java +++ b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/CodeNarcRulesDefinitionTest.java @@ -41,7 +41,7 @@ public void test() { assertThat(repository.language()).isEqualTo(Groovy.KEY); List rules = repository.rules(); - assertThat(rules).hasSize(347); + assertThat(rules).hasSize(361); List missingDebt = new LinkedList<>(); for (Rule rule : rules) { diff --git a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java index e88c01d7..94872e63 100644 --- a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java +++ b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java @@ -49,7 +49,7 @@ public void shouldCreateProfile() { assertThat(profile.getName()).isEqualTo("Sonar way"); assertThat(profile.getLanguage()).isEqualTo(Groovy.KEY); - assertThat(profile.getActiveRules()).hasSize(59); + assertThat(profile.getActiveRules()).hasSize(361); assertThat(messages.hasErrors()).isFalse(); CodeNarcRulesDefinition definition = new CodeNarcRulesDefinition(); From 23df6d6de6e5f8c1af42bfc46ccdfac4cfd8cea8 Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Wed, 31 Oct 2018 17:05:49 +0100 Subject: [PATCH 06/14] removed property from CodeNarc 1.3 --- .../src/main/resources/org/sonar/plugins/groovy/rules.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml index 0a64eedf..acd6d193 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml @@ -3408,11 +3408,6 @@ for (int i = 0; i < 100; ++i) {
]]>
bug - - ignoreImports - , then do not check imports. ]]> - false - ignoreStaticImports , then do not check static imports. ]]> From 6f783b850284a681dfbd46b689f1f6f5c9934bce Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Wed, 31 Oct 2018 17:09:34 +0100 Subject: [PATCH 07/14] bumped version to RC4 --- groovy-jacoco-previous/pom.xml | 2 +- pom.xml | 2 +- sonar-groovy-plugin/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/groovy-jacoco-previous/pom.xml b/groovy-jacoco-previous/pom.xml index a86f6add..c84defd0 100644 --- a/groovy-jacoco-previous/pom.xml +++ b/groovy-jacoco-previous/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC3 + 1.6-RC4 groovy-jacoco-previous diff --git a/pom.xml b/pom.xml index 273af15a..8f3e5c77 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.sonarsource.groovy groovy - 1.6-RC3 + 1.6-RC4 pom Sonar Groovy diff --git a/sonar-groovy-plugin/pom.xml b/sonar-groovy-plugin/pom.xml index af25e49f..d23dff18 100644 --- a/sonar-groovy-plugin/pom.xml +++ b/sonar-groovy-plugin/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC3 + 1.6-RC4 sonar-groovy-plugin From d8ec2c04185675439d4c3eb223112d506e91f25f Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Wed, 31 Oct 2018 17:41:25 +0100 Subject: [PATCH 08/14] removed enhanced rules from the default sets --- groovy-jacoco-previous/pom.xml | 2 +- pom.xml | 2 +- sonar-groovy-plugin/pom.xml | 2 +- .../plugins/groovy/profile-sonar-way.xml | 50 +++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/groovy-jacoco-previous/pom.xml b/groovy-jacoco-previous/pom.xml index c84defd0..77e7bc7b 100644 --- a/groovy-jacoco-previous/pom.xml +++ b/groovy-jacoco-previous/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC4 + 1.6-RC5 groovy-jacoco-previous diff --git a/pom.xml b/pom.xml index 8f3e5c77..8c47fdac 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.sonarsource.groovy groovy - 1.6-RC4 + 1.6-RC5 pom Sonar Groovy diff --git a/sonar-groovy-plugin/pom.xml b/sonar-groovy-plugin/pom.xml index d23dff18..00683bae 100644 --- a/sonar-groovy-plugin/pom.xml +++ b/sonar-groovy-plugin/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC4 + 1.6-RC5 sonar-groovy-plugin diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml index 327cab8a..a1301c3f 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml @@ -412,11 +412,11 @@ org.codenarc.rule.design.ReturnsNullInsteadOfEmptyCollectionRule MINOR - - grvy - org.codenarc.rule.design.CompareToWithoutComparableRule - MINOR - + + + + + grvy org.codenarc.rule.design.SimpleDateFormatMissingLocaleRule @@ -427,11 +427,11 @@ org.codenarc.rule.design.AbstractClassWithoutAbstractMethodRule MINOR - - grvy - org.codenarc.rule.design.CloseWithoutCloseableRule - MINOR - + + + + + grvy org.codenarc.rule.design.ConstantsOnlyInterfaceRule @@ -472,11 +472,11 @@ org.codenarc.rule.design.PrivateFieldCouldBeFinalRule.fixed MAJOR - - grvy - org.codenarc.rule.design.CloneWithoutCloneableRule - MINOR - + + + + + grvy org.codenarc.rule.design.LocaleSetDefaultRule @@ -872,11 +872,11 @@ org.codenarc.rule.junit.JUnitPublicFieldRule MAJOR - - grvy - org.codenarc.rule.junit.JUnitAssertEqualsConstantActualValueRule - MINOR - + + + + + grvy org.codenarc.rule.junit.JUnitPublicPropertyRule.fixed @@ -1377,11 +1377,11 @@ org.codenarc.rule.security.NonFinalPublicFieldRule MINOR - - grvy - org.codenarc.rule.security.UnsafeImplementationAsMapRule - MINOR - + + + + + grvy org.codenarc.rule.formatting.BracesForClassRule From 53905defb90ff33eb132ef4e665af870ee691e7e Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Thu, 1 Nov 2018 09:40:17 +0100 Subject: [PATCH 09/14] improved default profile --- .../plugins/groovy/profile-sonar-way.xml | 163 +++++++++++++++--- 1 file changed, 138 insertions(+), 25 deletions(-) diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml index a1301c3f..cb8cd03c 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml @@ -506,21 +506,45 @@ grvy org.codenarc.rule.dry.DuplicateNumberLiteralRule MINOR + + + doNotApplyToClassNames + *Spec + + grvy org.codenarc.rule.dry.DuplicateStringLiteralRule MINOR + + + doNotApplyToClassNames + *Spec + + grvy org.codenarc.rule.dry.DuplicateMapLiteralRule MAJOR + + + doNotApplyToClassNames + *Spec + + grvy org.codenarc.rule.dry.DuplicateListLiteralRule MAJOR + + + doNotApplyToClassNames + *Spec + + grvy @@ -622,16 +646,16 @@ org.codenarc.rule.exceptions.ExceptionExtendsThrowableRule MINOR - - grvy - org.codenarc.rule.generic.IllegalRegexRule.fixed - MAJOR - - - grvy - org.codenarc.rule.generic.RequiredRegexRule.fixed - MAJOR - + + + + + + + + + + grvy org.codenarc.rule.generic.RequiredStringRule.fixed @@ -922,50 +946,127 @@ org.codenarc.rule.logging.MultipleLoggersRule MINOR - - grvy - org.codenarc.rule.naming.AbstractClassNameRule.fixed - MINOR - + + + + + grvy org.codenarc.rule.naming.ClassNameRule MINOR + + + doNotApplyToClassNames + ([A-Z]\\w*\\$?)* + + grvy org.codenarc.rule.naming.FieldNameRule.fixed MINOR + + + ignoreFieldNames + log,serialVersionUID + + + regex + [a-z][a-zA-Z0-9]* + + + staticFinalRegex + [A-Z][A-Z0-9_]* + + + staticRegex + + [a-z][a-zA-Z0-9]* + + - - grvy - org.codenarc.rule.naming.InterfaceNameRule.fixed - MINOR - + + + + + grvy org.codenarc.rule.naming.MethodNameRule.fixed MINOR + + + doNotApplyToClassNames + *Spec + + + regex + [a-z]\\w* + + grvy org.codenarc.rule.naming.PackageNameRule MINOR + + + regex + [a-z]+[a-z0-9]*(\\.[a-z0-9]+)* + + grvy org.codenarc.rule.naming.ParameterNameRule.fixed MINOR + + + regex + [a-z][a-zA-Z0-9]* + + grvy org.codenarc.rule.naming.PropertyNameRule.fixed MINOR + + + ignorePropertyNames + log,serialVersionUID + + + regex + [a-z][a-zA-Z0-9]* + + + staticFinalRegex + [A-Z][A-Z0-9_]* + + + staticRegex + + [a-z][a-zA-Z0-9]* + + grvy org.codenarc.rule.naming.VariableNameRule.fixed MINOR + + + regex + [a-z][a-zA-Z0-9]* + + + finalRegex + + [A-Z][A-Z0-9_]* + + grvy @@ -981,6 +1082,12 @@ grvy org.codenarc.rule.naming.FactoryMethodNameRule MINOR + + + regex + (build.*\|create.*) + + grvy @@ -1152,11 +1259,11 @@ org.codenarc.rule.unnecessary.UnnecessaryOverridingMethodRule MAJOR - - grvy - org.codenarc.rule.unnecessary.UnnecessaryReturnKeywordRule - MAJOR - + + + + + grvy org.codenarc.rule.unnecessary.UnnecessaryStringInstantiationRule @@ -1391,6 +1498,12 @@ grvy org.codenarc.rule.formatting.LineLengthRule MINOR + + + length + 160 + + grvy From 5ea481cf115b87610ad0f00ccdb84557702dd0c4 Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Thu, 1 Nov 2018 09:43:24 +0100 Subject: [PATCH 10/14] corrected the expected number of violations in the profile --- .../org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java index 94872e63..5b75595e 100644 --- a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java +++ b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java @@ -49,7 +49,7 @@ public void shouldCreateProfile() { assertThat(profile.getName()).isEqualTo("Sonar way"); assertThat(profile.getLanguage()).isEqualTo(Groovy.KEY); - assertThat(profile.getActiveRules()).hasSize(361); + assertThat(profile.getActiveRules()).hasSize(351); assertThat(messages.hasErrors()).isFalse(); CodeNarcRulesDefinition definition = new CodeNarcRulesDefinition(); From 45f0054d7086f601501c18f645f7ae4482c3be11 Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Thu, 1 Nov 2018 11:34:43 +0100 Subject: [PATCH 11/14] disabled faulty rules from default profile --- groovy-jacoco-previous/pom.xml | 2 +- pom.xml | 2 +- sonar-groovy-plugin/pom.xml | 2 +- .../plugins/groovy/profile-sonar-way.xml | 84 +++++++++---------- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/groovy-jacoco-previous/pom.xml b/groovy-jacoco-previous/pom.xml index 77e7bc7b..2ee6284e 100644 --- a/groovy-jacoco-previous/pom.xml +++ b/groovy-jacoco-previous/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC5 + 1.6-RC6 groovy-jacoco-previous diff --git a/pom.xml b/pom.xml index 8c47fdac..14f5488c 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.sonarsource.groovy groovy - 1.6-RC5 + 1.6-RC6 pom Sonar Groovy diff --git a/sonar-groovy-plugin/pom.xml b/sonar-groovy-plugin/pom.xml index 00683bae..bed8b8f4 100644 --- a/sonar-groovy-plugin/pom.xml +++ b/sonar-groovy-plugin/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC5 + 1.6-RC6 sonar-groovy-plugin diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml index cb8cd03c..f3066bb1 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml @@ -951,17 +951,17 @@ - - grvy - org.codenarc.rule.naming.ClassNameRule - MINOR - - - doNotApplyToClassNames - ([A-Z]\\w*\\$?)* - - - + + + + + + + + + + + grvy org.codenarc.rule.naming.FieldNameRule.fixed @@ -991,32 +991,32 @@ - - grvy - org.codenarc.rule.naming.MethodNameRule.fixed - MINOR - - - doNotApplyToClassNames - *Spec - - - regex - [a-z]\\w* - - - - - grvy - org.codenarc.rule.naming.PackageNameRule - MINOR - - - regex - [a-z]+[a-z0-9]*(\\.[a-z0-9]+)* - - - + + + + + + + + + + + + + + + + + + + + + + + + + + grvy org.codenarc.rule.naming.ParameterNameRule.fixed @@ -1595,11 +1595,11 @@ org.codenarc.rule.formatting.SpaceAroundClosureArrowRule MAJOR - - grvy - org.codenarc.rule.formatting.SpaceAroundMapEntryColonRule - MAJOR - + + + + + grvy org.codenarc.rule.formatting.ClosureStatementOnOpeningLineOfMultipleLineClosureRule From a6723fd313962e875e576d01931e3c0140c90d8d Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Thu, 1 Nov 2018 11:36:09 +0100 Subject: [PATCH 12/14] corrected the expected number of violations in the profile --- .../org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java index 5b75595e..b2317097 100644 --- a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java +++ b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java @@ -49,7 +49,7 @@ public void shouldCreateProfile() { assertThat(profile.getName()).isEqualTo("Sonar way"); assertThat(profile.getLanguage()).isEqualTo(Groovy.KEY); - assertThat(profile.getActiveRules()).hasSize(351); + assertThat(profile.getActiveRules()).hasSize(347); assertThat(messages.hasErrors()).isFalse(); CodeNarcRulesDefinition definition = new CodeNarcRulesDefinition(); From d766187c078b948d3c2f8240d81d632a693a9fd9 Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Fri, 2 Nov 2018 10:05:47 +0100 Subject: [PATCH 13/14] catching errors during processing CodeNarc rules --- groovy-jacoco-previous/pom.xml | 2 +- pom.xml | 2 +- sonar-groovy-plugin/pom.xml | 2 +- .../codenarc/CodeNarcSourceAnalyzer.java | 19 ++++++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/groovy-jacoco-previous/pom.xml b/groovy-jacoco-previous/pom.xml index 2ee6284e..f7e161f4 100644 --- a/groovy-jacoco-previous/pom.xml +++ b/groovy-jacoco-previous/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC6 + 1.6-RC7 groovy-jacoco-previous diff --git a/pom.xml b/pom.xml index 14f5488c..0d39dd3c 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.sonarsource.groovy groovy - 1.6-RC6 + 1.6-RC7 pom Sonar Groovy diff --git a/sonar-groovy-plugin/pom.xml b/sonar-groovy-plugin/pom.xml index bed8b8f4..e5fabdab 100644 --- a/sonar-groovy-plugin/pom.xml +++ b/sonar-groovy-plugin/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC6 + 1.6-RC7 sonar-groovy-plugin diff --git a/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/codenarc/CodeNarcSourceAnalyzer.java b/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/codenarc/CodeNarcSourceAnalyzer.java index de707232..4242b946 100644 --- a/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/codenarc/CodeNarcSourceAnalyzer.java +++ b/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/codenarc/CodeNarcSourceAnalyzer.java @@ -32,10 +32,14 @@ import org.codenarc.rule.Violation; import org.codenarc.ruleset.RuleSet; import org.codenarc.source.SourceFile; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.batch.fs.InputFile; public class CodeNarcSourceAnalyzer extends AbstractSourceAnalyzer { + private static final Logger LOGGER = LoggerFactory.getLogger(CodeNarcSourceAnalyzer.class); + private final Map> violationsByFile = new HashMap<>(); private final List sourceFiles; @@ -56,11 +60,16 @@ public Results analyze(RuleSet ruleSet) { private Map> processFiles(RuleSet ruleSet) { Map> results = new HashMap<>(); for (InputFile inputFile : sourceFiles) { - List violations = collectViolations(new SourceFile(inputFile.file()), ruleSet); - violationsByFile.put(inputFile, violations); - FileResults result = new FileResults(inputFile.absolutePath(), violations); - results.putIfAbsent(inputFile.file().getParentFile(), new LinkedList<>()); - results.get(inputFile.file().getParentFile()).add(result); + try { + List violations = collectViolations(new SourceFile(inputFile.file()), ruleSet); + violationsByFile.put(inputFile, violations); + FileResults result = new FileResults(inputFile.absolutePath(), violations); + results.putIfAbsent(inputFile.file().getParentFile(), new LinkedList<>()); + results.get(inputFile.file().getParentFile()).add(result); + } catch (Exception e) { + LOGGER.error("Exception processing file " + inputFile.relativePath(), e); + } + } return results; } From 9473478cced3f08d57bb5aabf82c13b8ab931afb Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Thu, 8 Nov 2018 16:54:05 +0100 Subject: [PATCH 14/14] removed empty values --- groovy-jacoco-previous/pom.xml | 2 +- pom.xml | 2 +- sonar-groovy-plugin/pom.xml | 2 +- .../plugins/groovy/profile-sonar-way.xml | 285 ++++++++++++++++++ .../org/sonar/plugins/groovy/rules.xml | 14 +- .../groovy/codenarc/SonarWayProfileTest.java | 2 +- 6 files changed, 296 insertions(+), 11 deletions(-) diff --git a/groovy-jacoco-previous/pom.xml b/groovy-jacoco-previous/pom.xml index f7e161f4..0f96fb40 100644 --- a/groovy-jacoco-previous/pom.xml +++ b/groovy-jacoco-previous/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC7 + 1.6-RC9 groovy-jacoco-previous diff --git a/pom.xml b/pom.xml index 0d39dd3c..cc372922 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.sonarsource.groovy groovy - 1.6-RC7 + 1.6-RC9 pom Sonar Groovy diff --git a/sonar-groovy-plugin/pom.xml b/sonar-groovy-plugin/pom.xml index e5fabdab..71f6dabb 100644 --- a/sonar-groovy-plugin/pom.xml +++ b/sonar-groovy-plugin/pom.xml @@ -5,7 +5,7 @@ org.sonarsource.groovy groovy - 1.6-RC7 + 1.6-RC9 sonar-groovy-plugin diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml index f3066bb1..b95cb53b 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/profile-sonar-way.xml @@ -21,6 +21,12 @@ grvy org.codenarc.rule.basic.EmptyCatchBlockRule MINOR + + + ignoreRegex + + + grvy @@ -246,6 +252,12 @@ grvy org.codenarc.rule.braces.ElseBlockBracesRule MINOR + + + bracesRequiredForElseIf + + + grvy @@ -471,6 +483,21 @@ grvy org.codenarc.rule.design.PrivateFieldCouldBeFinalRule.fixed MAJOR + + + ignoreFieldNames + + + + ignoreJpaEntities + + + + + + grvy + org.codenarc.rule.design.CloneWithoutCloneableRule + MINOR @@ -491,6 +518,12 @@ grvy org.codenarc.rule.design.InstanceofRule MINOR + + + ignoreTypeNames + + + grvy @@ -660,41 +693,125 @@ grvy org.codenarc.rule.generic.RequiredStringRule.fixed MAJOR + + + string + + + grvy org.codenarc.rule.generic.StatelessClassRule.fixed MINOR + + + addToIgnoreFieldNames + + + + ignoreFieldNames + + + + ignoreFieldTypes + + + grvy org.codenarc.rule.generic.IllegalPackageReferenceRule.fixed MINOR + + + packageNames + + + grvy org.codenarc.rule.generic.IllegalClassReferenceRule.fixed MINOR + + + classNames + + + grvy org.codenarc.rule.generic.IllegalClassMemberRule.fixed MINOR + + + allowedFieldModifiers + + + + allowedMethodModifiers + + + + allowedPropertyModifiers + + + + ignoreMethodNames + + + + ignoreMethodsWithAnnotationNames + + + + illegalFieldModifiers + + + + illegalMethodModifiers + + + + illegalPropertyModifiers + + + grvy org.codenarc.rule.generic.IllegalStringRule.fixed MINOR + + + string + + + grvy org.codenarc.rule.generic.IllegalSubclassRule.fixed MINOR + + + superclassNames + + + grvy org.codenarc.rule.grails.GrailsPublicControllerMethodRule.fixed MINOR + + + ignoreMethodNames + + + grvy @@ -705,6 +822,16 @@ grvy org.codenarc.rule.grails.GrailsStatelessServiceRule MINOR + + + ignoreFieldNames + + + + ignoreFieldTypes + + + grvy @@ -730,6 +857,16 @@ grvy org.codenarc.rule.grails.GrailsDomainReservedSqlKeywordNameRule MINOR + + + additionalHibernateBasicTypes + + + + additionalReservedSqlKeywords + + + grvy @@ -780,6 +917,12 @@ grvy org.codenarc.rule.imports.NoWildcardImportsRule MAJOR + + + ignoreStaticImports + + + grvy @@ -835,6 +978,12 @@ grvy org.codenarc.rule.junit.UseAssertTrueInsteadOfAssertEqualsRule MAJOR + + + checkAssertStatements + + + grvy @@ -880,6 +1029,16 @@ grvy org.codenarc.rule.junit.SpockIgnoreRestUsedRule.fixed MINOR + + + specificationClassNames + + + + specificationSuperclassNames + + + grvy @@ -905,6 +1064,12 @@ grvy org.codenarc.rule.junit.JUnitPublicPropertyRule.fixed MINOR + + + ignorePropertyNames + + + grvy @@ -1022,6 +1187,10 @@ org.codenarc.rule.naming.ParameterNameRule.fixed MINOR + + ignoreParameterNames + + regex [a-z][a-zA-Z0-9]* @@ -1033,6 +1202,10 @@ org.codenarc.rule.naming.PropertyNameRule.fixed MINOR + + finalRegex + + ignorePropertyNames log,serialVersionUID @@ -1098,6 +1271,12 @@ grvy org.codenarc.rule.naming.PackageNameMatchesFilePathRule.fixed MINOR + + + groupId + + + grvy @@ -1113,41 +1292,141 @@ grvy org.codenarc.rule.size.ClassSizeRule MAJOR + + + maxLines + + + grvy org.codenarc.rule.size.CyclomaticComplexityRule.fixed MINOR + + + ignoreMethodNames + + + + maxClassAverageMethodComplexity + + + + maxClassComplexity + + + + maxMethodComplexity + + + grvy org.codenarc.rule.size.MethodCountRule MINOR + + + maxMethods + + + grvy org.codenarc.rule.size.MethodSizeRule.fixed MAJOR + + + ignoreMethodNames + + + + maxLines + + + grvy org.codenarc.rule.size.NestedBlockDepthRule MINOR + + + ignoreRegex + + + + maxNestedBlockDepth + + + grvy org.codenarc.rule.size.CrapMetricRule.fixed MINOR + + + coberturaXmlFile + + + + ignoreMethodNames + + + + maxClassAverageMethodCrapScore + + + + maxClassCrapScore + + + + maxMethodCrapScore + + + grvy org.codenarc.rule.size.AbcMetricRule.fixed MINOR + + + ignoreMethodNames + + + + maxClassAbcScore + + + + maxClassAverageMethodAbcScore + + + + maxMethodAbcScore + + + grvy org.codenarc.rule.size.ParameterCountRule MINOR + + + ignoreOverriddenMethods + + + + maxParameters + + + grvy @@ -1203,6 +1482,12 @@ grvy org.codenarc.rule.unnecessary.UnnecessaryConstructorRule MAJOR + + + ignoreAnnotations + + + grvy diff --git a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml index acd6d193..e613eb84 100644 --- a/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml +++ b/sonar-groovy-plugin/src/main/resources/org/sonar/plugins/groovy/rules.xml @@ -4007,7 +4007,7 @@ for (int i = 0; i < 100; ++i) { regex - ([A-Z]\\w*\\$?)* + ([A-Z]\w*\$?)* @@ -4075,7 +4075,7 @@ for (int i = 0; i < 100; ++i) { regex - [a-z]\\w* + [a-z]\w* @@ -4095,7 +4095,7 @@ for (int i = 0; i < 100; ++i) { regex - [a-z]+[a-z0-9]*(\\.[a-z0-9]+)* + [a-z]+[a-z0-9]*(\.[a-z0-9]+)* @@ -6512,13 +6512,13 @@ for (int i = 0; i < 100; ++i) { convention characterAfterColonRegex - entry. For example, /\\S/ matches any non-whitespace character and /\\s/ matches any whitespace character (thus requiring a space or whitespace). ]]> - \\S + entry. For example, /\S/ matches any non-whitespace character and /\s/ matches any whitespace character (thus requiring a space or whitespace). ]]> + \S characterBeforeColonRegex - entry. For example, /\\S/ matches any non-whitespace character and /\\s/ matches any whitespace character (thus requiring a space or whitespace). ]]> - \\S + entry. For example, /\S/ matches any non-whitespace character and /\s/ matches any whitespace character (thus requiring a space or whitespace). ]]> + \S diff --git a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java index b2317097..2b797da8 100644 --- a/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java +++ b/sonar-groovy-plugin/src/test/java/org/sonar/plugins/groovy/codenarc/SonarWayProfileTest.java @@ -49,7 +49,7 @@ public void shouldCreateProfile() { assertThat(profile.getName()).isEqualTo("Sonar way"); assertThat(profile.getLanguage()).isEqualTo(Groovy.KEY); - assertThat(profile.getActiveRules()).hasSize(347); + assertThat(profile.getActiveRules()).hasSize(348); assertThat(messages.hasErrors()).isFalse(); CodeNarcRulesDefinition definition = new CodeNarcRulesDefinition();