diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-11-30 10:55:26 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-11-30 14:10:37 +0400 |
commit | 3243252e10fd86b2ba845d287e3ef0058955385f (patch) | |
tree | 9bd81b5ee8a58c31f811637ea4b6a846f3a92824 /plugins/sonar-checkstyle-plugin | |
parent | 39768a567bdf6e52316e51c665cfead5a7128c25 (diff) | |
download | sonarqube-3243252e10fd86b2ba845d287e3ef0058955385f.tar.gz sonarqube-3243252e10fd86b2ba845d287e3ef0058955385f.zip |
SONAR-1836 Upgrade to Checkstyle 5.5
New rules in 5.2:
* InnerTypeLast
Modified rules in 5.2:
* DeclarationOrder
* ImportOrder
New rules in 5.3:
* OuterTypeFilename
* NestedForDepth
* MethodCount
* OneStatementPerLine
Modified rules in 5.3:
* PackageDeclaration
* MagicNumber
* AbstractClassName
* AvoidStarImport
Modified rules in 5.4:
* UnusedImports
* MagicNumber
* EqualsAvoidNull
* IllegalThrows
* RedundantModifier
Diffstat (limited to 'plugins/sonar-checkstyle-plugin')
-rw-r--r-- | plugins/sonar-checkstyle-plugin/pom.xml | 40 | ||||
-rw-r--r-- | plugins/sonar-checkstyle-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml | 94 |
2 files changed, 82 insertions, 52 deletions
diff --git a/plugins/sonar-checkstyle-plugin/pom.xml b/plugins/sonar-checkstyle-plugin/pom.xml index fafb431f097..1d94817ee37 100644 --- a/plugins/sonar-checkstyle-plugin/pom.xml +++ b/plugins/sonar-checkstyle-plugin/pom.xml @@ -14,24 +14,9 @@ <description>Checkstyle is a code analyser to help programmers write Java code that adheres to a coding standard.</description> <properties> - <checkstyle.version>5.1.2</checkstyle.version> + <checkstyle.version>5.5</checkstyle.version> </properties> - <repositories> - <!-- for checkstyle 5.1.x --> - <repository> - <id>sonar</id> - <name>Sonar</name> - <url>http://repository.sonarsource.org/content/repositories/sonar</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> - <dependencies> <dependency> <groupId>org.codehaus.sonar</groupId> @@ -39,8 +24,8 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>com.sonarsource.checkstyle</groupId> - <artifactId>checkstyle-java7</artifactId> + <groupId>com.puppycrawl.tools</groupId> + <artifactId>checkstyle</artifactId> <version>${checkstyle.version}</version> <exclusions> <exclusion> @@ -68,6 +53,11 @@ <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils-core</artifactId> </exclusion> + <exclusion> + <!-- Checkstyle 5.5 declares this dependency, whereas 5.1 not --> + <groupId>com.sun</groupId> + <artifactId>tools</artifactId> + </exclusion> </exclusions> </dependency> @@ -106,20 +96,6 @@ </testResources> <plugins> <plugin> - <!-- TODO remove (see SONAR-2938) --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-enforcer-plugin</artifactId> - <executions> - <execution> - <id>enforce-no-repositories</id> - <configuration> - <skip>true</skip> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> <groupId>org.codehaus.sonar</groupId> <artifactId>sonar-packaging-maven-plugin</artifactId> <configuration> diff --git a/plugins/sonar-checkstyle-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml b/plugins/sonar-checkstyle-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml index 4f9030f57f5..af6e0f68cae 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml +++ b/plugins/sonar-checkstyle-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml @@ -93,7 +93,9 @@ <name><![CDATA[Equals Avoid Null]]></name> <configKey><![CDATA[Checker/TreeWalker/EqualsAvoidNull]]></configKey> - + <param key="ignoreEqualsIgnoreCase" type="b"> + <defaultValue>false</defaultValue> + </param> </rule> @@ -278,17 +280,12 @@ <param key="format" type="r"> <defaultValue>^Abstract.*$|^.*Factory$</defaultValue> </param> - <!-- - Not supported yet <param key="ignoreModifier" type="b"> - <defaultValue>false</defaultValue> </param> <param key="ignoreName" type="b"> - <defaultValue>false</defaultValue> </param> - --> </rule> <rule key="com.puppycrawl.tools.checkstyle.checks.sizes.AnonInnerLengthCheck"> <priority>MAJOR</priority> @@ -339,9 +336,13 @@ <name><![CDATA[Avoid Star Import]]></name> <configKey><![CDATA[Checker/TreeWalker/AvoidStarImport]]></configKey> - <param key="excludes" type="s{}"> - + </param> + <param key="allowClassImports" type="b"> + <defaultValue>false</defaultValue> + </param> + <param key="allowStaticMemberImports" type="b"> + <defaultValue>false</defaultValue> </param> </rule> <rule key="com.puppycrawl.tools.checkstyle.checks.metrics.BooleanExpressionComplexityCheck"> @@ -424,7 +425,9 @@ <name><![CDATA[Declaration Order]]></name> <configKey><![CDATA[Checker/TreeWalker/DeclarationOrder]]></configKey> - + <param key="ignoreConstructors" type="b" /> + <param key="ignoreMethods" type="b" /> + <param key="ignoreModifiers" type="b" /> </rule> <rule key="com.puppycrawl.tools.checkstyle.checks.coding.DefaultComesLastCheck"> <priority>MAJOR</priority> @@ -634,9 +637,9 @@ <name><![CDATA[Illegal Throws]]></name> <configKey><![CDATA[Checker/TreeWalker/IllegalThrows]]></configKey> - <param key="illegalClassNames" type="s{}"> - + </param> + <param key="ignoredMethodNames" type="s{}"> </param> </rule> <rule key="com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenCheck"> @@ -933,12 +936,15 @@ <name><![CDATA[Magic Number]]></name> <configKey><![CDATA[Checker/TreeWalker/MagicNumber]]></configKey> - <param key="tokens" type="s[NUM_DOUBLE,NUM_FLOAT,NUM_INT,NUM_LONG]"> - </param> <param key="ignoreNumbers" type="i{}"> - + </param> + <param key="ignoreHashCodeMethod" type="b"> + <defaultValue>false</defaultValue> + </param> + <param key="ignoreAnnotation" type="b"> + <defaultValue>false</defaultValue> </param> </rule> <rule key="com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck"> @@ -1177,7 +1183,7 @@ <name><![CDATA[Package Declaration]]></name> <configKey><![CDATA[Checker/TreeWalker/PackageDeclaration]]></configKey> - + <param key="ignoreDirectoryName" type="b" /> </rule> <rule key="com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck"> @@ -1239,9 +1245,7 @@ <name><![CDATA[Redundant Modifier]]></name> <configKey><![CDATA[Checker/TreeWalker/RedundantModifier]]></configKey> - - <param key="tokens" type="s[METHOD_DEF,VARIABLE_DEF,ANNOTATION_FIELD_DEF]"> - + <param key="tokens" type="s[METHOD_DEF,VARIABLE_DEF,ANNOTATION_FIELD_DEF,INTERFACE_DEF]"> </param> </rule> <rule key="com.puppycrawl.tools.checkstyle.checks.coding.RedundantThrowsCheck"> @@ -1519,7 +1523,9 @@ <name><![CDATA[Unused Imports]]></name> <configKey><![CDATA[Checker/TreeWalker/UnusedImports]]></configKey> - + <param key="processJavadoc" type="b"> + <defaultValue>false</defaultValue> + </param> </rule> <rule key="com.puppycrawl.tools.checkstyle.checks.UpperEllCheck"> <priority>MINOR</priority> @@ -1589,4 +1595,52 @@ </param> </rule> -</rules>
\ No newline at end of file + + <rule key="com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck"> + <priority>INFO</priority> + <name><![CDATA[Inner Type Last]]></name> + <configKey><![CDATA[Checker/TreeWalker/InnerTypeLast]]></configKey> + </rule> + + <rule key="com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck"> + <priority>MAJOR</priority> + <name><![CDATA[Outer Type Filename]]></name> + <configKey><![CDATA[Checker/TreeWalker/OuterTypeFilename]]></configKey> + </rule> + + <rule key="com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck"> + <priority>MAJOR</priority> + <name><![CDATA[Nested For Depth]]></name> + <configKey><![CDATA[Checker/TreeWalker/NestedForDepth]]></configKey> + <param key="max" type="i"> + <defaultValue>1</defaultValue> + </param> + </rule> + + <rule key="com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck"> + <priority>MAJOR</priority> + <name><![CDATA[Method Count]]></name> + <configKey><![CDATA[Checker/TreeWalker/MethodCount]]></configKey> + <param key="maxTotal" type="i"> + <defaultValue>100</defaultValue> + </param> + <param key="maxPrivate" type="i"> + <defaultValue>100</defaultValue> + </param> + <param key="maxPackage" type="i"> + <defaultValue>100</defaultValue> + </param> + <param key="maxProtected" type="i"> + <defaultValue>100</defaultValue> + </param> + <param key="maxPublic" type="i"> + <defaultValue>100</defaultValue> + </param> + </rule> + + <rule key="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck"> + <priority>MAJOR</priority> + <name><![CDATA[One Statement Per Line]]></name> + <configKey><![CDATA[Checker/TreeWalker/OneStatementPerLine]]></configKey> + </rule> +</rules> |