From 3720bde6d03de9646ac6d190c7bdbdccba387ec2 Mon Sep 17 00:00:00 2001 From: Daniel Muehlbachler Date: Tue, 10 Sep 2019 15:36:50 +0200 Subject: [PATCH] Issue #231: update to CS 8.22 --- README.md | 1 + pom.xml | 2 +- .../com/sonar/sqale/checkstyle-model.xml | 52 +++++++++++++++++++ .../org/sonar/l10n/checkstyle.properties | 6 +++ ...ckstyle.checks.OrderedPropertiesCheck.html | 13 +++++ ...nnecessarySemicolonInEnumerationCheck.html | 4 ++ ...ssarySemicolonInTryWithResourcesCheck.html | 3 ++ ...ks.javadoc.MissingJavadocPackageCheck.html | 8 +++ .../org/sonar/plugins/checkstyle/rules.xml | 32 ++++++++++++ .../CheckstyleRulesDefinitionTest.java | 2 +- 10 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck.html create mode 100644 src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInEnumerationCheck.html create mode 100644 src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck.html create mode 100644 src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck.html diff --git a/README.md b/README.md index 2c991b1d..c5709c59 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pom.xml b/pom.xml index e8dc5bf2..639ace7b 100644 --- a/pom.xml +++ b/pom.xml @@ -81,7 +81,7 @@ - 8.21 + 8.22 6.7 5.12.0.17701 2.17 diff --git a/src/main/resources/com/sonar/sqale/checkstyle-model.xml b/src/main/resources/com/sonar/sqale/checkstyle-model.xml index ccfb9c00..867954a9 100644 --- a/src/main/resources/com/sonar/sqale/checkstyle-model.xml +++ b/src/main/resources/com/sonar/sqale/checkstyle-model.xml @@ -1193,6 +1193,19 @@ min + + checkstyle + com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck + + remediationFunction + CONSTANT_ISSUE + + + offset + 10 + min + + checkstyle com.puppycrawl.tools.checkstyle.checks.metrics.BooleanExpressionComplexityCheck @@ -1297,6 +1310,32 @@ min + + checkstyle + com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck + + remediationFunction + CONSTANT_ISSUE + + + offset + 10 + min + + + + checkstyle + com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInEnumerationCheck + + remediationFunction + CONSTANT_ISSUE + + + offset + 10 + min + + checkstyle com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck @@ -1310,6 +1349,19 @@ min + + checkstyle + com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck + + remediationFunction + CONSTANT_ISSUE + + + offset + 30 + min + + checkstyle com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck diff --git a/src/main/resources/org/sonar/l10n/checkstyle.properties b/src/main/resources/org/sonar/l10n/checkstyle.properties index a8b9091c..877b4fab 100644 --- a/src/main/resources/org/sonar/l10n/checkstyle.properties +++ b/src/main/resources/org/sonar/l10n/checkstyle.properties @@ -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 @@ -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 @@ -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 diff --git a/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck.html b/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck.html new file mode 100644 index 00000000..2c741248 --- /dev/null +++ b/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck.html @@ -0,0 +1,13 @@ +

+ Detects if keys in properties files are in correct order. +
+ 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. + <suppress checks="OrderedProperties" files="log4j.properties|ResourceBundle/Bug.*.properties|logging.properties"/> +
+ Known limitation: The key should not contain a newline. The string compare will work, but not the line number + reporting. +

diff --git a/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInEnumerationCheck.html b/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInEnumerationCheck.html new file mode 100644 index 00000000..cf5e6bc0 --- /dev/null +++ b/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInEnumerationCheck.html @@ -0,0 +1,4 @@ +

+ Checks if unnecessary semicolon is in enum definitions. Semicolon is not needed if enum body contains only enum + constants. +

diff --git a/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck.html b/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck.html new file mode 100644 index 00000000..b631f61c --- /dev/null +++ b/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonInTryWithResourcesCheck.html @@ -0,0 +1,3 @@ +

+ Checks if unnecessary semicolon is used in last resource declaration. +

diff --git a/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck.html b/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck.html new file mode 100644 index 00000000..4e59d020 --- /dev/null +++ b/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck.html @@ -0,0 +1,8 @@ +

+ Checks for missing Javadoc comments in package-info.java files. +
+ 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 link for + more info. +

diff --git a/src/main/resources/org/sonar/plugins/checkstyle/rules.xml b/src/main/resources/org/sonar/plugins/checkstyle/rules.xml index 90567917..9ed58f09 100644 --- a/src/main/resources/org/sonar/plugins/checkstyle/rules.xml +++ b/src/main/resources/org/sonar/plugins/checkstyle/rules.xml @@ -128,6 +128,14 @@ READY + + MINOR + + comment + + READY + + MAJOR @@ -1755,6 +1763,15 @@ + + MAJOR + + + + properties + + + MAJOR @@ -1960,6 +1977,21 @@ + + + MAJOR + + + true + + + + + + MAJOR + + + MAJOR diff --git a/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java b/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java index 954d51be..484266b8 100644 --- a/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java +++ b/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java @@ -61,7 +61,7 @@ public void test() { assertThat(repository.language()).isEqualTo("java"); final List rules = repository.rules(); - assertThat(rules).hasSize(159); + assertThat(rules).hasSize(163); for (RulesDefinition.Rule rule : rules) { assertThat(rule.key()).isNotNull();