Skip to content

Commit

Permalink
Adapt checkstyle.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Oct 5, 2024
1 parent c004615 commit 4457ee5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
25 changes: 15 additions & 10 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
<module name="NewlineAtEndOfFile"/>

<!-- Prevent empty start and end of blocks - source: comments to https://stackoverflow.com/a/48027770/873282 -->
<!--
<module name="RegexpMultiline">
<property name="message" value="Blank line at start of block should be removed" />
<property name="format" value="(\(.*\)|else)\s*\{\s*[\r]?\n\s*[\r]?\n" />
<property name="fileExtensions" value="groovy,java" />
</module>
-->
<module name="RegexpMultiline">
<property name="message" value="Blank line at end of block should be removed" />
<property name="format" value="[\r]?\n\s*[\r]?\n\s*\}" />
Expand All @@ -53,13 +55,14 @@
<module name="RedundantImport"/>
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="ImportOrder">
<property name="groups" value="java,javax,javafx,org.jabref,*"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="bottom"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>

<!-- not working source: https://raw.githubusercontent.com/checkstyle/checkstyle/ee37567e7b96f4e385868b77f11d63a213718b35/src/main/resources/google_checks.xml
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
<property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF"/>
</module> -->

<!-- Checks for whitespace: https://checkstyle.org/config_whitespace.html -->

Expand All @@ -78,20 +81,22 @@
<module name="NoWhitespaceBefore"/>
<module name="ParenPad"/>
<module name="SeparatorWrap">
<property name="tokens" value="COMMA, SEMI, ELLIPSIS, ARRAY_DECLARATOR, RBRACK, METHOD_REF"/>
<!-- METHOID_REF is not followed by Google -->
<property name="tokens" value="COMMA, SEMI, ELLIPSIS, ARRAY_DECLARATOR, RBRACK"/>
</module>
<module name="SingleSpaceSeparator"/>
<module name="NoWhitespaceBeforeCaseDefaultColon"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<!-- RCULRY causes issues if classes are nested within arrays, therefore not activated -->
<!-- LCURLY, SLIST is not followed by Google -->
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV,
DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL,
PLUS, PLUS_ASSIGN, QUESTION,
SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
</module>

<!-- Checks for Naming Conventions: https://checkstyle.org/config_naming.html -->
Expand Down
26 changes: 15 additions & 11 deletions config/checkstyle/checkstyle_reviewdog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
<module name="NewlineAtEndOfFile"/>

<!-- Prevent empty start and end of blocks - source: comments to https://stackoverflow.com/a/48027770/873282 -->
<!--
<module name="RegexpMultiline">
<property name="message" value="Blank line at start of block should be removed" />
<property name="format" value="(\(.*\)|else)\s*\{\s*[\r]?\n\s*[\r]?\n" />
<property name="fileExtensions" value="groovy,java" />
</module>
-->
<module name="RegexpMultiline">
<property name="message" value="Blank line at end of block should be removed" />
<property name="format" value="[\r]?\n\s*[\r]?\n\s*\}" />
Expand All @@ -53,13 +55,14 @@
<module name="RedundantImport"/>
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="ImportOrder">
<property name="groups" value="java,javax,javafx,org.jabref,*"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="bottom"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>

<!-- not working source: https://raw.githubusercontent.com/checkstyle/checkstyle/ee37567e7b96f4e385868b77f11d63a213718b35/src/main/resources/google_checks.xml
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
<property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF"/>
</module> -->

<!-- Checks for whitespace: https://checkstyle.org/config_whitespace.html -->

Expand All @@ -78,22 +81,23 @@
<module name="NoWhitespaceBefore"/>
<module name="ParenPad"/>
<module name="SeparatorWrap">
<property name="tokens" value="COMMA, SEMI, ELLIPSIS, ARRAY_DECLARATOR, RBRACK, METHOD_REF"/>
<!-- METHOID_REF is not followed by Google -->
<property name="tokens" value="COMMA, SEMI, ELLIPSIS, ARRAY_DECLARATOR, RBRACK"/>
</module>
<module name="SingleSpaceSeparator"/>
<module name="NoWhitespaceBeforeCaseDefaultColon"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<!-- RCULRY causes issues if classes are nested within arrays, therefore not activated -->
<!-- LCURLY, SLIST is not followed by Google -->
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV,
DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL,
PLUS, PLUS_ASSIGN, QUESTION,
SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
</module>

<!-- Checks for Naming Conventions: https://checkstyle.org/config_naming.html -->
<module name="ConstantName">
<property name="format" value="^log(ger)?|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
Expand Down

0 comments on commit 4457ee5

Please sign in to comment.