Skip to content

Commit a95f1d1

Browse files
committed
Forbid no/abundant whitespace before array initializer
Forbid these new int[]{... new int[] {....
1 parent 7909ffe commit a95f1d1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Airbase 149
22
* Remove bval dependency
33
* Checkstyle updates:
44
- Disallow single-line non-empty lambda and method body code blocks.
5+
- Require exactly one space between array type and array initializer.
56
* Plugin updates:
67
- git-commit-id-maven-plugin 7.0.0 (from 6.0.0)
78
- spotbugs-maven-plugins 4.8.1.0 (from 4.7.3.6)

airbase-policy/src/main/resources/checkstyle/airbase-checks.xml

+8
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,14 @@
272272
<property name="ignoreComments" value="true" />
273273
</module>
274274

275+
<module name="RegexpSinglelineJava">
276+
<!-- Forbid "new Type[]{", IntelliJ would reformat adding a space -->
277+
<!-- Forbid "new Type[] {", IntelliJ would reformat removing a space -->
278+
<property name="format" value="new\s++\w++(&lt;\?&gt;)?(\[\])++(?! )\s*+\{" />
279+
<property name="message" value="Incorrect whitespace before array initializer" />
280+
<property name="ignoreComments" value="true" />
281+
</module>
282+
275283
<!-- javadoc -->
276284
<module name="RequireEmptyLineBeforeBlockTagGroup" />
277285
<module name="NonEmptyAtclauseDescription" />

0 commit comments

Comments
 (0)