Skip to content

Commit 0c1132d

Browse files
authored
Add new check for format (#13909)
* Add new check for format * Introduce formatting issue * Fix quotes * Try to fix parameter * Change action * Add failing * Add another bad thing * Add step name * Output changed files * Output changes * Do not align parameters * Disable JavaDoc formatting * Comment on wrong format * Revert "Add another bad thing" This reverts commit 4589701. * Revert "Introduce formatting issue" This reverts commit 6f9b353. * Remove empty lines * Fix formatting issue * Revise code style message in ghprcomment.yml
1 parent ccda46d commit 0c1132d

File tree

7 files changed

+24
-5
lines changed

7 files changed

+24
-5
lines changed

.github/ghprcomment.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
4040
You can then run these tests in IntelliJ to reproduce the failing tests locally.
4141
We offer a quick test running howto in the section [Final build system checks](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide.
42+
- jobName: format
43+
workflowName: 'Source Code Tests'
44+
message: >
45+
Your code currently does not meet JabRef's code guidelines.
46+
IntelliJ auto format covers some cases.
47+
There seem to be issues with your code style and autoformat configuration.
48+
Please reformat your code (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>L</kbd>) and commit, then push.
49+
50+
51+
In special cases, consider using `// formatter:off` and `// formatter:on` annotations to allow deviation from the code style.
4252
- jobName: Checkstyle
4353
workflowName: 'Source Code Tests'
4454
message: >

.github/workflows/tests-code.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ jobs:
114114
run: |
115115
./gradlew --no-configuration-cache :rewriteDryRun
116116
117+
format:
118+
runs-on: ubuntu-latest
119+
steps:
120+
- uses: actions/checkout@v5
121+
- uses: koppor/intellij-idea-format@update-to-latest-intellij
122+
with:
123+
file-mask: "*.java"
124+
settings-file: "config/IntelliJ Code Style.xml"
125+
# job should fail in case there are changes
126+
- name: Check if any files changed
127+
run: git diff --exit-code
128+
117129
modernizer:
118130
name: Modernizer
119131
runs-on: ubuntu-latest

config/IntelliJ Code Style.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
</option>
3636
<option name="RECORD_COMPONENTS_WRAP" value="0" />
3737
<option name="MULTI_CATCH_TYPES_WRAP" value="0" />
38+
<option name="ENABLE_JAVADOC_FORMATTING" value="false" />
3839
</JavaCodeStyleSettings>
3940
<codeStyleSettings language="JAVA">
4041
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
@@ -306,4 +307,4 @@
306307
</rules>
307308
</arrangement>
308309
</codeStyleSettings>
309-
</code_scheme>
310+
</code_scheme>

jablib/src/test/java/org/jabref/logic/exporter/CffExporterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package org.jabref.logic.exporter;
32

43
import java.io.IOException;

jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package org.jabref.logic.formatter.bibtexfields;
32

43
import org.junit.jupiter.api.BeforeEach;

jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package org.jabref.logic.formatter.bibtexfields;
32

43
import org.junit.jupiter.api.BeforeEach;

jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package org.jabref.logic.formatter.bibtexfields;
32

43
import org.junit.jupiter.api.BeforeEach;

0 commit comments

Comments
 (0)