Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbid code that would reformat poorly #389

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Airbase 149
* Remove bval dependency
* Checkstyle updates:
- Disallow single-line non-empty lambda and method body code blocks.
* 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 Expand Up @@ -1162,4 +1164,3 @@ Airbase 2
Airbase 1

* Initial release

16 changes: 16 additions & 0 deletions airbase-policy/src/main/resources/checkstyle/airbase-checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,22 @@
<property name="ignoreComments" value="true" />
</module>

<module name="RegexpSinglelineJava">
<!-- when "{" denotes conditional/loop statement body, IntelliJ would reformat adding line break -->
<!-- when "{" denotes method/lambda body, and closing brace is on the same line, IntelliJ would remove whitespace before throw, violating "{" whitespace expectations-->
<property name="format" value="\{\s*+throw\b" />
<property name="message" value="No new line before throw" />
<property name="ignoreComments" value="true" />
</module>

<module name="RegexpSinglelineJava">
<!-- when "}" denotes end of conditional/loop statement body, IntelliJ would reformat adding line break -->
<!-- when "}" denotes end of method/lambda body and opening brace is on the same line, IntelliJ would remove whitespace before the brace, violating "}" whitespace expectations-->
<property name="format" value=";\s*+\}(?!&quot;)" />
<property name="message" value="No new line before closing brace" />
<property name="ignoreComments" value="true" />
</module>

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