From 69ee78e50e7e8c6f6e5f7ce6aeecf9f6efc434fc Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 4 Jul 2017 12:31:12 +0100 Subject: [PATCH] WhiteSpaceBeforeArrayInitializer: enable rule --- README.md | 23 +++++++++++++++---- builder/src/main/resources/application.yml | 3 +-- .../rules/WhitespaceBeforeArrayInitializer.md | 17 ++++++++++++++ .../net/kemitix/checkstyle-1-layout.xml | 1 + .../net/kemitix/checkstyle-2-naming.xml | 1 + .../net/kemitix/checkstyle-3-javadoc.xml | 1 + .../net/kemitix/checkstyle-4-tweaks.xml | 1 + .../net/kemitix/checkstyle-5-complexity.xml | 1 + 8 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 builder/src/main/resources/rules/WhitespaceBeforeArrayInitializer.md diff --git a/README.md b/README.md index 6097cad..872948b 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file diff --git a/builder/src/main/resources/application.yml b/builder/src/main/resources/application.yml index 2afaf9b..5da6e97 100644 --- a/builder/src/main/resources/application.yml +++ b/builder/src/main/resources/application.yml @@ -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 diff --git a/builder/src/main/resources/rules/WhitespaceBeforeArrayInitializer.md b/builder/src/main/resources/rules/WhitespaceBeforeArrayInitializer.md new file mode 100644 index 0000000..75703f6 --- /dev/null +++ b/builder/src/main/resources/rules/WhitespaceBeforeArrayInitializer.md @@ -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}; +```` diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml index dcb2199..8b69e34 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml @@ -59,6 +59,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml index a4a70a0..330545e 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml @@ -91,6 +91,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml index 5536268..00f2043 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml @@ -117,6 +117,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml index 2f79826..d363925 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml @@ -178,6 +178,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml index 57e70ec..4a96257 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml @@ -231,6 +231,7 @@ +