Skip to content

Commit

Permalink
Forbid no/abundant whitespace before array initializer
Browse files Browse the repository at this point in the history
Forbid these

    new int[]{...

    new int[]    {....
  • Loading branch information
findepi committed Jan 10, 2024
1 parent 81fb318 commit ebb63fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Airbase 149
* Remove bval dependency
* Checkstyle updates:
- Disallow single-line non-empty lambda and method body code blocks.
- Require exactly one space between array type and array initializer.
* Plugin updates:
- git-commit-id-maven-plugin 7.0.0 (from 6.0.0)
- spotbugs-maven-plugins 4.8.1.0 (from 4.7.3.6)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@
<property name="ignoreComments" value="true" />
</module>

<module name="RegexpSinglelineJava">
<!-- Forbid "new Type[]{", IntelliJ would reformat adding a space -->
<!-- Forbid "new Type[] {", IntelliJ would reformat removing a space -->
<property name="format" value="new\s++\w++(&lt;\?&gt;)?(\[\])++(?! )\s*+\{" />
<property name="message" value="Incorrect whitespace before array initializer" />
<property name="ignoreComments" value="true" />
</module>

<!-- javadoc -->
<module name="RequireEmptyLineBeforeBlockTagGroup" />
<module name="NonEmptyAtclauseDescription" />
Expand Down

0 comments on commit ebb63fe

Please sign in to comment.