Skip to content

Commit 7e3651c

Browse files
committed
Issue #151: upgrade to checkstyle 8.11
1 parent f10709a commit 7e3651c

File tree

10 files changed

+45
-17
lines changed

10 files changed

+45
-17
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This plugin provides coding rules from [Checkstyle](http://checkstyle.sourceforg
1717

1818
Checkstyle Plugin|Sonar|Checkstyle|Jdk
1919
-----------------|-----|----------|---
20+
4.11|5.6.6|8.10.1|1.8
2021
4.10.1|5.6.6|8.10.1|1.8
2122
4.10|5.6.6|8.10|1.8
2223
4.9|5.6.6|8.9|1.8

checkstyle-sonar-plugin/pom.xml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
<properties>
1818
<maven.checkstyle.plugin.version>2.17</maven.checkstyle.plugin.version>
1919
<maven.sevntu.checkstyle.plugin.version>1.29.0</maven.sevntu.checkstyle.plugin.version>
20+
<!-- it should be a version of checkstyle that is compatible/compiled with sevntu -->
21+
<maven.sevntu.checkstyle.plugin.checkstyle.version>
22+
8.10
23+
</maven.sevntu.checkstyle.plugin.checkstyle.version>
2024
</properties>
2125

2226
<dependencies>
@@ -166,7 +170,7 @@
166170
<dependency>
167171
<groupId>com.puppycrawl.tools</groupId>
168172
<artifactId>checkstyle</artifactId>
169-
<version>${checkstyle.version}</version>
173+
<version>${maven.sevntu.checkstyle.plugin.checkstyle.version}</version>
170174
</dependency>
171175
<dependency>
172176
<groupId>com.github.sevntu-checkstyle</groupId>
@@ -182,7 +186,7 @@
182186
<goal>check</goal>
183187
</goals>
184188
<configuration>
185-
<configLocation>https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml</configLocation>
189+
<configLocation>https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${maven.sevntu.checkstyle.plugin.checkstyle.version}/config/checkstyle_checks.xml</configLocation>
186190
<failOnViolation>true</failOnViolation>
187191
<headerLocation>I just need to put here smth to let it not use default - LICENSE.txt</headerLocation>
188192
<propertiesLocation>config/checkstyle.properties</propertiesLocation>
@@ -390,12 +394,4 @@
390394
</plugins>
391395
</build>
392396

393-
<pluginRepositories>
394-
<pluginRepository>
395-
<id>sevntu-maven</id>
396-
<name>sevntu-maven</name>
397-
<url>http://sevntu-checkstyle.github.io/sevntu.checkstyle/maven2</url>
398-
</pluginRepository>
399-
</pluginRepositories>
400-
401397
</project>

checkstyle-sonar-plugin/src/main/resources/com/sonar/sqale/checkstyle-model.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,19 @@
448448
<txt>min</txt>
449449
</prop>
450450
</chc>
451+
<chc>
452+
<rule-repo>checkstyle</rule-repo>
453+
<rule-key>com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck</rule-key>
454+
<prop>
455+
<key>remediationFunction</key>
456+
<txt>CONSTANT_ISSUE</txt>
457+
</prop>
458+
<prop>
459+
<key>offset</key>
460+
<val>10</val>
461+
<txt>min</txt>
462+
</prop>
463+
</chc>
451464
<chc>
452465
<rule-repo>checkstyle</rule-repo>
453466
<rule-key>com.puppycrawl.tools.checkstyle.checks.naming.CatchParameterNameCheck</rule-key>

checkstyle-sonar-plugin/src/main/resources/org/sonar/l10n/checkstyle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck
152152
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.format=Regular expression
153153
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.ignoreOverridden=Allows to skip methods with Override annotation from validation.
154154
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.accessModifiers=Access modifiers of methods where parameters are checked.
155+
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.name=Lambda Parameter Name
156+
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.param.format=Regular expression
155157
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck.name=Redundant Modifier
156158
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck.param.tokens=tokens to check
157159
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck.name=Empty For Initializer Pad
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Check to verify lambda parameter names.
2+
For more details please refere to <a href="http://checkstyle.sourceforge.net/config_naming.html#LambdaParameterName">online documentation</a>
3+
<p>
4+
</p>

checkstyle-sonar-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,16 @@
13051305
<status>READY</status>
13061306
</rule>
13071307

1308+
<rule key="com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck">
1309+
<priority>MAJOR</priority>
1310+
<name><![CDATA[Parameter Name]]></name>
1311+
<configKey><![CDATA[Checker/TreeWalker/LambdaParameterName]]></configKey>
1312+
<param key="format" type="REGULAR_EXPRESSION">
1313+
<defaultValue>^[a-z][a-zA-Z0-9]*$</defaultValue>
1314+
</param>
1315+
<status>READY</status>
1316+
</rule>
1317+
13081318
<rule key="com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck">
13091319
<priority>MAJOR</priority>
13101320
<name><![CDATA[Parameter Number]]></name>

checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void test() {
5656
assertThat(repository.language()).isEqualTo("java");
5757

5858
final List<RulesDefinition.Rule> rules = repository.rules();
59-
assertThat(rules).hasSize(154);
59+
assertThat(rules).hasSize(155);
6060

6161
for (RulesDefinition.Rule rule : rules) {
6262
assertThat(rule.key()).isNotNull();

checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/CheckUtil.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
import com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck;
4040
import com.puppycrawl.tools.checkstyle.guava.collect.ImmutableSet;
4141
import com.puppycrawl.tools.checkstyle.guava.reflect.ClassPath;
42-
import com.puppycrawl.tools.checkstyle.utils.JavadocUtils;
43-
import com.puppycrawl.tools.checkstyle.utils.TokenUtils;
42+
import com.puppycrawl.tools.checkstyle.utils.JavadocUtil;
43+
import com.puppycrawl.tools.checkstyle.utils.TokenUtil;
4444

4545
public final class CheckUtil {
4646
private CheckUtil() {
@@ -240,7 +240,7 @@ public static String getTokenText(int[] tokens, int... subtractions) {
240240
result.append(',');
241241
}
242242

243-
result.append(TokenUtils.getTokenName(token));
243+
result.append(TokenUtil.getTokenName(token));
244244
}
245245

246246
return result.toString();
@@ -271,7 +271,7 @@ public static String getJavadocTokenText(int[] tokens, int... subtractions) {
271271
result.append(',');
272272
}
273273

274-
result.append(JavadocUtils.getTokenName(token));
274+
result.append(JavadocUtil.getTokenName(token));
275275
}
276276

277277
return result.toString();

checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/internal/ChecksTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,9 @@ else if (AbstractFileSetCheck.class.isAssignableFrom(clss)) {
395395

396396
// remove undocumented properties
397397
new HashSet<>(properties).stream()
398-
.filter(p -> UNDOCUMENTED_PROPERTIES.contains(clss.getSimpleName() + "." + p))
398+
.filter(property -> {
399+
return UNDOCUMENTED_PROPERTIES.contains(clss.getSimpleName() + "." + property);
400+
})
399401
.forEach(properties::remove);
400402

401403
if (AbstractCheck.class.isAssignableFrom(clss)) {

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
</ciManagement>
8686

8787
<properties>
88-
<checkstyle.version>8.10.1</checkstyle.version>
88+
<checkstyle.version>8.11</checkstyle.version>
8989
<sonar.version>5.6.6</sonar.version>
9090
<sonar-java.version>3.7</sonar-java.version>
9191
<java.version>1.8</java.version>

0 commit comments

Comments
 (0)