Skip to content

Commit 72d5c11

Browse files
Daniel Muehlbachlerromani
authored andcommitted
Issue #286: update CS 8.30
1 parent 7a74b2d commit 72d5c11

File tree

8 files changed

+32
-3
lines changed

8 files changed

+32
-3
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.30|7.9 |7.9+|8.30|1.8
2425
4.29|7.9 |7.9+|8.29|1.8
2526
4.28|7.9 |7.9+|8.28|11
2627
4.27|6.7 |7.7+|8.27|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.29</checkstyle.version>
96+
<checkstyle.version>8.30</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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.junit.Test;
2727

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

3131
@Test
3232
public void testJarPresence() {

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,19 @@
15751575
<txt>min</txt>
15761576
</prop>
15771577
</chc>
1578+
<chc>
1579+
<rule-repo>checkstyle</rule-repo>
1580+
<rule-key>com.puppycrawl.tools.checkstyle.checks.coding.AvoidDoubleBraceInitializationCheck</rule-key>
1581+
<prop>
1582+
<key>remediationFunction</key>
1583+
<txt>CONSTANT_ISSUE</txt>
1584+
</prop>
1585+
<prop>
1586+
<key>offset</key>
1587+
<val>20</val>
1588+
<txt>min</txt>
1589+
</prop>
1590+
</chc>
15781591
<chc>
15791592
<rule-repo>checkstyle</rule-repo>
15801593
<rule-key>com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck</rule-key>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.AvoidNoArgumentSup
152152
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NestedTryDepthCheck.name=Nested Try Depth
153153
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NestedTryDepthCheck.param.max=allowed nesting depth. Default is 1.
154154
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.NoArrayTrailingCommaCheck.name=No Array Trailing Comma
155+
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.AvoidDoubleBraceInitializationCheck.name=Avoid Double Brace Initialization
155156
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.TrailingCommentCheck.name=Trailing Comment
156157
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.TrailingCommentCheck.param.legalComment=pattern for text of trailing comment which is allowed. (this patter will not be applied to multiline comments and text of comment will be trimmed before matching)
157158
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.TrailingCommentCheck.param.format=pattern for string allowed before comment.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<p>
2+
Detects double brace initialization.
3+
<br>
4+
Rationale: Double brace initialization (set of Instance Initializers in class body) may look cool, but it is
5+
considered as anti-pattern and should be avoided. This is also can lead to a hard-to-detect memory leak, if the
6+
anonymous class instance is returned outside and other object(s) hold reference to it.
7+
</p>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,13 @@
12991299
<status>READY</status>
13001300
</rule>
13011301

1302+
<rule key="com.puppycrawl.tools.checkstyle.checks.coding.AvoidDoubleBraceInitializationCheck">
1303+
<priority>MAJOR</priority>
1304+
<name><![CDATA[Avoid Double Brace Initialization]]></name>
1305+
<configKey><![CDATA[Checker/TreeWalker/AvoidDoubleBraceInitialization]]></configKey>
1306+
<status>READY</status>
1307+
</rule>
1308+
13021309
<rule key="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck">
13031310
<priority>MINOR</priority>
13041311
<name><![CDATA[Newline At End Of File]]></name>

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(170);
64+
assertThat(rules).hasSize(171);
6565

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

0 commit comments

Comments
 (0)