Skip to content

Commit 2aa87a4

Browse files
author
Daniel Muehlbachler
committed
Issue #281: update to CS 8.29
1 parent 07970bc commit 2aa87a4

File tree

10 files changed

+62
-6
lines changed

10 files changed

+62
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Compatibility matrix from checkstyle team:
2121

2222
Checkstyle Plugin|Sonar min|Sonar max|Checkstyle|Jdk
2323
-----------------|---------|---------|----------|---
24+
4.29|7.9 |7.9+|8.29|1.8
2425
4.28|7.9 |7.9+|8.28|11
2526
4.27|6.7 |7.7+|8.27|1.8
2627
4.26|6.7 |7.7+|8.26|1.8

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
</ciManagement>
9494

9595
<properties>
96-
<checkstyle.version>8.28</checkstyle.version>
96+
<checkstyle.version>8.29</checkstyle.version>
9797
<sonar.version>7.9</sonar.version>
9898
<sonar-java.version>6.0.0.20538</sonar-java.version>
9999
<maven.checkstyle.plugin.version>3.1.0</maven.checkstyle.plugin.version>

src/it/java/org/checkstyle/plugins/sonar/CheckJarTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@
2626
import org.junit.Test;
2727

2828
public class CheckJarTest {
29+
private static final String VERSION = "4.29";
2930

3031
@Test
3132
public void testJarPresence() {
33+
final boolean snapshotExists = new File("target/checkstyle-sonar-plugin-"
34+
+ VERSION + "-SNAPSHOT.jar").exists();
35+
final boolean releaseExists = new File("target/checkstyle-sonar-plugin-"
36+
+ VERSION + ".jar").exists();
3237
assertTrue("Jar should exists",
33-
new File("target/checkstyle-sonar-plugin-4.28-SNAPSHOT.jar").exists());
38+
snapshotExists || releaseExists);
3439
}
3540
}

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,19 @@
14531453
<txt>min</txt>
14541454
</prop>
14551455
</chc>
1456+
<chc>
1457+
<rule-repo>checkstyle</rule-repo>
1458+
<rule-key>com.puppycrawl.tools.checkstyle.checks.coding.AvoidNoArgumentSuperConstructorCallCheck</rule-key>
1459+
<prop>
1460+
<key>remediationFunction</key>
1461+
<txt>CONSTANT_ISSUE</txt>
1462+
</prop>
1463+
<prop>
1464+
<key>offset</key>
1465+
<val>15</val>
1466+
<txt>min</txt>
1467+
</prop>
1468+
</chc>
14561469
</chc>
14571470
</chc>
14581471
<chc>
@@ -2023,6 +2036,19 @@
20232036
<txt>min</txt>
20242037
</prop>
20252038
</chc>
2039+
<chc>
2040+
<rule-repo>checkstyle</rule-repo>
2041+
<rule-key>com.puppycrawl.tools.checkstyle.checks.coding.NoEnumTrailingCommaCheck</rule-key>
2042+
<prop>
2043+
<key>remediationFunction</key>
2044+
<txt>CONSTANT_ISSUE</txt>
2045+
</prop>
2046+
<prop>
2047+
<key>offset</key>
2048+
<val>20</val>
2049+
<txt>min</txt>
2050+
</prop>
2051+
</chc>
20262052
<chc>
20272053
<rule-repo>checkstyle</rule-repo>
20282054
<rule-key>com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck</rule-key>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck.param.
148148
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck.param.charset=character encoding to use when reading the headerFile
149149
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck.param.fileExtensions=file type extension of files to process
150150
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.AvoidInlineConditionalsCheck.name=Avoid Inline Conditionals
151+
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.AvoidNoArgumentSuperConstructorCallCheck.name=Avoid No Argument Super Constructor Call
151152
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NestedTryDepthCheck.name=Nested Try Depth
152153
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NestedTryDepthCheck.param.max=allowed nesting depth. Default is 1.
153154
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NoArrayTrailingCommaCheck.name=No Array Trailing Comma
@@ -450,6 +451,7 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck.pa
450451
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.ArrayTrailingCommaCheck.name=Array Trailing Comma
451452
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.whitespace.GenericWhitespaceCheck.name=Generic Whitespace
452453
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NoCloneCheck.name=No Clone
454+
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NoEnumTrailingCommaCheck.name=No Enum Trailing Comma
453455
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck.name=Inner Type Last
454456
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck.name=Outer Type Filename
455457
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheck.name=Ordered Properties
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
Checks if call to superclass constructor without arguments is present. Such invocation is redundant because constructor body implicitly begins with a superclass constructor invocation super(); See <a href="https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.8.7">specification</a> for detailed information.
3+
</p>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Checks for fall through in switch statements Finds locations where a case contains Java code - but lacks a break, return, throw or continue statement.
2-
31
<p>
2+
Checks for fall through in switch statements Finds locations where a case contains Java code - but lacks a break, return, throw or continue statement.<br>
3+
4+
The check honors special comments to suppress the warning. By default the texts "fallthru", "fall thru", "fall-thru", "fallthrough", "fall through", "fall-through" "fallsthrough", "falls through", "falls-through" (case sensitive). The comment containing these words must be all on one line, and must be on the last non-empty line before the case triggering the warning or on the same line before the case (ugly, but possible).
45
</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
Checks that enum definition does not contain a trailing comma. Rationale: JLS allows trailing commas in arrays and enumerations, but does not allow them in other locations. To unify the coding style, the use of trailing commas should be prohibited.
3+
</p>

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@
9797
<configKey><![CDATA[Checker/TreeWalker/NoClone]]></configKey>
9898
</rule>
9999

100+
<rule key="com.puppycrawl.tools.checkstyle.checks.coding.NoEnumTrailingCommaCheck">
101+
<priority>MAJOR</priority>
102+
<name><![CDATA[No Enum Trailing Comma]]></name>
103+
<configKey><![CDATA[Checker/TreeWalker/NoEnumTrailingComma]]></configKey>
104+
</rule>
105+
100106
<rule key="com.puppycrawl.tools.checkstyle.checks.coding.NoFinalizerCheck">
101107
<priority>MAJOR</priority>
102108
<name><![CDATA[No Finalizer]]></name>
@@ -321,6 +327,13 @@
321327
<status>READY</status>
322328
</rule>
323329

330+
<rule key="com.puppycrawl.tools.checkstyle.checks.coding.AvoidNoArgumentSuperConstructorCallCheck">
331+
<priority>MINOR</priority>
332+
<name><![CDATA[Avoid No Argument Super Constructor Call]]></name>
333+
<configKey><![CDATA[Checker/TreeWalker/AvoidNoArgumentSuperConstructorCall]]></configKey>
334+
<status>READY</status>
335+
</rule>
336+
324337
<rule key="com.puppycrawl.tools.checkstyle.checks.blocks.AvoidNestedBlocksCheck">
325338
<priority>MAJOR</priority>
326339
<name><![CDATA[Avoid Nested Blocks]]></name>
@@ -552,8 +565,10 @@
552565
<name><![CDATA[Fall Through]]></name>
553566
<configKey><![CDATA[Checker/TreeWalker/FallThrough]]></configKey>
554567
<param key="checkLastCaseGroup" type="BOOLEAN">
568+
<defaultValue>false</defaultValue>
555569
</param>
556570
<param key="reliefPattern" type="REGULAR_EXPRESSION">
571+
<defaultValue>falls?[ -]?thr(u|ough)</defaultValue>
557572
</param>
558573
<status>READY</status>
559574
</rule>
@@ -1488,7 +1503,7 @@
14881503
<param key="option" type="s[same,alone,alone_or_singleline]">
14891504
<defaultValue>same</defaultValue>
14901505
</param>
1491-
<param key="tokens" type="s[LITERAL_TRY,LITERAL_CATCH,LITERAL_FINALLY,LITERAL_IF,LITERAL_ELSE,CLASS_DEF,METHOD_DEF,CTOR_DEF,LITERAL_FOR,LITERAL_WHILE,LITERAL_DO,STATIC_INIT,INSTANCE_INIT,ANNOTATION_DEF]">
1506+
<param key="tokens" type="s[LITERAL_TRY,LITERAL_CATCH,LITERAL_FINALLY,LITERAL_IF,LITERAL_ELSE,CLASS_DEF,METHOD_DEF,CTOR_DEF,LITERAL_FOR,LITERAL_WHILE,LITERAL_DO,STATIC_INIT,INSTANCE_INIT,ANNOTATION_DEF,ENUM_DEF]">
14921507
<defaultValue>LITERAL_TRY,LITERAL_CATCH,LITERAL_FINALLY,LITERAL_IF,LITERAL_ELSE</defaultValue>
14931508
</param>
14941509
<status>READY</status>

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

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

6363
final List<RulesDefinition.Rule> rules = repository.rules();
64-
assertThat(rules).hasSize(168);
64+
assertThat(rules).hasSize(170);
6565

6666
for (RulesDefinition.Rule rule : rules) {
6767
assertThat(rule.key()).isNotNull();

0 commit comments

Comments
 (0)