WhiteSpaceBeforeArrayInitializer: enable rule

This commit is contained in:
Paul Campbell 2017-07-04 12:31:12 +01:00
parent 55ff66d98b
commit 69ee78e50e
8 changed files with 42 additions and 6 deletions

View file

@ -268,7 +268,7 @@ Rule|Level|Source|Enabled|Suppressible
[VisibilityModifier](#visibilitymodifier)|tweaks|checkstyle|Yes|No
[WhitespaceAfter](#whitespaceafter)|layout|checkstyle|Yes|
[WhitespaceAround](#whitespacearound)|layout|checkstyle|Yes|
[WhitespaceBeforeArrayInitializer](#whitespacebeforearrayinitializer)|layout|sevntu||
[WhitespaceBeforeArrayInitializer](#whitespacebeforearrayinitializer)|layout|sevntu|Yes|
[WriteTag](#writetag)|unspecified|checkstyle||
## Enabled Checks
@ -2607,6 +2607,24 @@ class Derived extends Base {
}
}
````
#### [WhitespaceBeforeArrayInitializer](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.html)
This checks enforces whitespace before array initializer.
Valid:
````java
int[] ints = new int[] {
0, 1, 2, 3
};
int[] tab = new int[]
{0, 1, 2, 3};
````
Invalid:
````java
int[] ints = new int[]{0, 1, 2, 3};
````
## Disabled Checks
@ -2733,8 +2751,5 @@ Generic rule; doesn't embody a 'quality' check.
#### [StaticMethodCandidate](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.html)
Can't handle private methods called by reflection, which may cause issues with Spring and other DI frameworks.
#### [WhitespaceBeforeArrayInitializer](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.html)
TODO: enable
[Effective Java]: http://amzn.to/2aSz6GE

View file

@ -1496,10 +1496,9 @@ rules:
name: WhitespaceBeforeArrayInitializer
parent: TREEWALKER
level: LAYOUT
enabled: false
enabled: true
source: SEVNTU
uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.html
reason: "TODO: enable"
-
name: MoveVariableInsideIfCheck
parent: TREEWALKER

View file

@ -0,0 +1,17 @@
This checks enforces whitespace before array initializer.
Valid:
````java
int[] ints = new int[] {
0, 1, 2, 3
};
int[] tab = new int[]
{0, 1, 2, 3};
````
Invalid:
````java
int[] ints = new int[]{0, 1, 2, 3};
````

View file

@ -59,6 +59,7 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.ForbidCCommentsInMethodsCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
</module><!-- /TreeWalker -->

View file

@ -91,6 +91,7 @@
<module name="com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.SimpleAccessorNameNotationCheck"/>
<module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
</module><!-- /TreeWalker -->

View file

@ -117,6 +117,7 @@
<module name="com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.SimpleAccessorNameNotationCheck"/>
<module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
</module><!-- /TreeWalker -->

View file

@ -178,6 +178,7 @@
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSingleCatchCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSuperCtorCallCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.EmptyPublicCtorInClassCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck"/>
</module><!-- /TreeWalker -->

View file

@ -231,6 +231,7 @@
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSingleCatchCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSuperCtorCallCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.EmptyPublicCtorInClassCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck"/>
</module><!-- /TreeWalker -->