Skip to content

Commit

Permalink
Issue checkstyle#231: update to CS 8.22
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Muehlbachler committed Sep 10, 2019
1 parent 1f56ee9 commit 3720bde
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Compatibility matrix from checkstyle team:

Checkstyle Plugin|Sonar min|Sonar max|Checkstyle|Jdk
-----------------|---------|---------|----------|---
4.22|6.7 |7.7+|8.22|1.8
4.21|6.7 |7.7+|8.21|1.8
4.20|6.7 |7.7+|8.20|1.8
4.19|6.7 |7.7+|8.19|1.8
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</ciManagement>

<properties>
<checkstyle.version>8.21</checkstyle.version>
<checkstyle.version>8.22</checkstyle.version>
<sonar.version>6.7</sonar.version>
<sonar-java.version>5.12.0.17701</sonar-java.version>
<maven.checkstyle.plugin.version>2.17</maven.checkstyle.plugin.version>
Expand Down
52 changes: 52 additions & 0 deletions src/main/resources/com/sonar/sqale/checkstyle-model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,19 @@
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>10</val>
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.metrics.BooleanExpressionComplexityCheck</rule-key>
Expand Down Expand Up @@ -1297,6 +1310,32 @@
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>10</val>
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInEnumerationCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>10</val>
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck</rule-key>
Expand All @@ -1310,6 +1349,19 @@
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>30</val>
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck</rule-key>
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/org/sonar/l10n/checkstyle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullChe
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck.name=Javadoc Package
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck.param.allowLegacy=If set then allow the use of a package.html file.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck.param.fileExtensions=file type extension of files to process
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck.name=Missing Javadoc Package
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.name=Declaration Order
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.param.ignoreModifiers=Whether to ignore modifiers
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.param.ignoreConstructors=Whether to ignore constructors
Expand Down Expand Up @@ -448,6 +449,8 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.whitespace.GenericWhitesp
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NoCloneCheck.name=No Clone
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck.name=Inner Type Last
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck.name=Outer Type Filename
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck.name=Ordered Properties
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck.param.fileExtensions=Specify file type extension of the files to check.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck.name=Nested For Depth
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck.param.max=allowed nesting depth.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.name=Method Count
Expand Down Expand Up @@ -494,6 +497,9 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapChec
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck.param.tokens=assignments to check
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.design.OneTopLevelClassCheck.name=One Top Level Class
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.OverloadMethodsDeclarationOrderCheck.name=Overload Methods Declaration Order
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInEnumerationCheck.name=Unnecessary Semicolon in Enumeration
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck.name=Unnecessary Semicolon in Resource Declaration
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck.param.allowWhenNoBraceAfterSemicolon=Allow unnecessary semicolon if closing paren is not on the same line.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck.name=Variable Declaration Usage Distance
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck.param.allowedDistance=A distance between declaration of variable and its first usage
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck.param.ignoreVariablePattern=pattern for ignoring the distance calculation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<p>
Detects if keys in properties files are in correct order.
<br>
Rationale: Sorted properties make it easy for people to find required properties by name in file. It makes merges
more easy. While there are no problems at runtime. This check is valuable only on files with string resources where
order of lines does not matter at all, but this can be improved. E.g.:
checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/messages.properties You may suppress warnings of this
check for files that have an logical structure like build files or log4j configuration files. See SuppressionFilter.
&lt;suppress checks="OrderedProperties" files="log4j.properties|ResourceBundle/Bug.*.properties|logging.properties"/&gt;
<br>
Known limitation: The key should not contain a newline. The string compare will work, but not the line number
reporting.
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p>
Checks if unnecessary semicolon is in enum definitions. Semicolon is not needed if enum body contains only enum
constants.
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
Checks if unnecessary semicolon is used in last resource declaration.
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<p>
Checks for missing Javadoc comments in package-info.java files.
<br>
Rationale: description and other related documentation for a package can be written up in the package-info.java file
and it gets used in the production of the Javadocs. See <a
href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html#packagecomment">link</a> for
more info.
</p>
32 changes: 32 additions & 0 deletions src/main/resources/org/sonar/plugins/checkstyle/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@
<status>READY</status>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck">
<priority>MINOR</priority>
<name><![CDATA[Missing Javadoc Package]]></name>
<tag>comment</tag>
<configKey><![CDATA[Checker/TreeWalker/MissingJavadocPackage]]></configKey>
<status>READY</status>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck">
<priority>MAJOR</priority>
<name><![CDATA[Regexp Multiline]]></name>
Expand Down Expand Up @@ -1755,6 +1763,15 @@
<configKey><![CDATA[Checker/TreeWalker/OuterTypeFilename]]></configKey>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck">
<priority>MAJOR</priority>
<name><![CDATA[Ordered Properties]]></name>
<configKey><![CDATA[Checker/OrderedProperties]]></configKey>
<param key="fileExtensions" type="s{}">
<defaultValue>properties</defaultValue>
</param>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck">
<priority>MAJOR</priority>
<name><![CDATA[Nested For Depth]]></name>
Expand Down Expand Up @@ -1960,6 +1977,21 @@
</param>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck">
<name><![CDATA[Unnecessary Semicolon in Resource Definition]]></name>
<priority>MAJOR</priority>
<configKey><![CDATA[Checker/TreeWalker/UnnecessarySemicolonInTryWithResources]]></configKey>
<param key="allowWhenNoBraceAfterSemicolon" type="BOOLEAN">
<defaultValue>true</defaultValue>
</param>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInEnumerationCheck">
<name><![CDATA[Unnecessary Semicolon in Enumeration]]></name>
<priority>MAJOR</priority>
<configKey><![CDATA[Checker/TreeWalker/UnnecessarySemicolonInEnumeration]]></configKey>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck">
<name><![CDATA[Annotation Location]]></name>
<priority>MAJOR</priority>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void test() {
assertThat(repository.language()).isEqualTo("java");

final List<RulesDefinition.Rule> rules = repository.rules();
assertThat(rules).hasSize(159);
assertThat(rules).hasSize(163);

for (RulesDefinition.Rule rule : rules) {
assertThat(rule.key()).isNotNull();
Expand Down

0 comments on commit 3720bde

Please sign in to comment.