From c0eeb898cb11d614fb3c8cffff1fba84a139a776 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 30 Jun 2018 21:47:03 -0700 Subject: [PATCH] Issue #151: upgrade to chekcstyle 8.11 --- README.md | 1 + checkstyle-sonar-plugin/pom.xml | 16 ++++++---------- .../com/sonar/sqale/checkstyle-model.xml | 13 +++++++++++++ .../org/sonar/l10n/checkstyle.properties | 2 ++ ...e.checks.naming.LambdaParameterNameCheck.html | 4 ++++ .../org/sonar/plugins/checkstyle/rules.xml | 10 ++++++++++ .../CheckstyleRulesDefinitionTest.java | 2 +- .../plugins/checkstyle/internal/CheckUtil.java | 8 ++++---- .../plugins/checkstyle/internal/ChecksTest.java | 4 +++- pom.xml | 2 +- 10 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.html diff --git a/README.md b/README.md index 7058190a..296f6fe8 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ This plugin provides coding rules from [Checkstyle](http://checkstyle.sourceforg Checkstyle Plugin|Sonar|Checkstyle|Jdk -----------------|-----|----------|--- +4.11|5.6.6|8.10.1|1.8 4.10.1|5.6.6|8.10.1|1.8 4.10|5.6.6|8.10|1.8 4.9|5.6.6|8.9|1.8 diff --git a/checkstyle-sonar-plugin/pom.xml b/checkstyle-sonar-plugin/pom.xml index c7ac62ec..f19a57d1 100644 --- a/checkstyle-sonar-plugin/pom.xml +++ b/checkstyle-sonar-plugin/pom.xml @@ -17,6 +17,10 @@ 2.17 1.29.0 + + + 8.10 + @@ -166,7 +170,7 @@ com.puppycrawl.tools checkstyle - ${checkstyle.version} + ${maven.sevntu.checkstyle.plugin.checkstyle.version} com.github.sevntu-checkstyle @@ -182,7 +186,7 @@ check - https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml + https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${maven.sevntu.checkstyle.plugin.checkstyle.version}/config/checkstyle_checks.xml true I just need to put here smth to let it not use default - LICENSE.txt config/checkstyle.properties @@ -390,12 +394,4 @@ - - - sevntu-maven - sevntu-maven - http://sevntu-checkstyle.github.io/sevntu.checkstyle/maven2 - - - diff --git a/checkstyle-sonar-plugin/src/main/resources/com/sonar/sqale/checkstyle-model.xml b/checkstyle-sonar-plugin/src/main/resources/com/sonar/sqale/checkstyle-model.xml index 055e46dd..cbfba07c 100644 --- a/checkstyle-sonar-plugin/src/main/resources/com/sonar/sqale/checkstyle-model.xml +++ b/checkstyle-sonar-plugin/src/main/resources/com/sonar/sqale/checkstyle-model.xml @@ -448,6 +448,19 @@ min + + checkstyle + com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck + + remediationFunction + CONSTANT_ISSUE + + + offset + 10 + min + + checkstyle com.puppycrawl.tools.checkstyle.checks.naming.CatchParameterNameCheck diff --git a/checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle.properties b/checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle.properties index 872b8947..f71e3840 100644 --- a/checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle.properties +++ b/checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle.properties @@ -152,6 +152,8 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.format=Regular expression rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.ignoreOverridden=Allows to skip methods with Override annotation from validation. rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.accessModifiers=Access modifiers of methods where parameters are checked. +rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.name=Lambda Parameter Name +rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.param.format=Regular expression rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck.name=Redundant Modifier rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck.param.tokens=tokens to check rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck.name=Empty For Initializer Pad diff --git a/checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.html b/checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.html new file mode 100644 index 00000000..dad0905c --- /dev/null +++ b/checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle/rules/checkstyle/com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.html @@ -0,0 +1,4 @@ +Check to verify lambda parameter names. +For more details please refere to online documentation +

+

diff --git a/checkstyle-sonar-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml b/checkstyle-sonar-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml index b5229a29..913df57c 100644 --- a/checkstyle-sonar-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml +++ b/checkstyle-sonar-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml @@ -1305,6 +1305,16 @@ READY + + MAJOR + + + + ^[a-z][a-zA-Z0-9]*$ + + READY + + MAJOR diff --git a/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java b/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java index 97bd7558..8bc2a514 100644 --- a/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java +++ b/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java @@ -56,7 +56,7 @@ public void test() { assertThat(repository.language()).isEqualTo("java"); final List rules = repository.rules(); - assertThat(rules).hasSize(154); + assertThat(rules).hasSize(155); for (RulesDefinition.Rule rule : rules) { assertThat(rule.key()).isNotNull(); diff --git a/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/CheckUtil.java b/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/CheckUtil.java index 6fd26691..8be0e7f0 100644 --- a/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/CheckUtil.java +++ b/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/CheckUtil.java @@ -39,8 +39,8 @@ import com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck; import com.puppycrawl.tools.checkstyle.guava.collect.ImmutableSet; import com.puppycrawl.tools.checkstyle.guava.reflect.ClassPath; -import com.puppycrawl.tools.checkstyle.utils.JavadocUtils; -import com.puppycrawl.tools.checkstyle.utils.TokenUtils; +import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; public final class CheckUtil { private CheckUtil() { @@ -240,7 +240,7 @@ public static String getTokenText(int[] tokens, int... subtractions) { result.append(','); } - result.append(TokenUtils.getTokenName(token)); + result.append(TokenUtil.getTokenName(token)); } return result.toString(); @@ -271,7 +271,7 @@ public static String getJavadocTokenText(int[] tokens, int... subtractions) { result.append(','); } - result.append(JavadocUtils.getTokenName(token)); + result.append(JavadocUtil.getTokenName(token)); } return result.toString(); diff --git a/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/ChecksTest.java b/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/ChecksTest.java index 476b8aaa..1172499c 100644 --- a/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/ChecksTest.java +++ b/checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/ChecksTest.java @@ -395,7 +395,9 @@ else if (AbstractFileSetCheck.class.isAssignableFrom(clss)) { // remove undocumented properties new HashSet<>(properties).stream() - .filter(p -> UNDOCUMENTED_PROPERTIES.contains(clss.getSimpleName() + "." + p)) + .filter(property -> { + return UNDOCUMENTED_PROPERTIES.contains(clss.getSimpleName() + "." + property); + }) .forEach(properties::remove); if (AbstractCheck.class.isAssignableFrom(clss)) { diff --git a/pom.xml b/pom.xml index bd84b7b0..0db6d992 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,7 @@ - 8.10.1 + 8.11 5.6.6 3.7 1.8