diff --git a/.github/ghprcomment.yml b/.github/ghprcomment.yml
index 7e5f9de7092..b226733c9d9 100644
--- a/.github/ghprcomment.yml
+++ b/.github/ghprcomment.yml
@@ -39,6 +39,16 @@
You can then run these tests in IntelliJ to reproduce the failing tests locally.
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.
+- jobName: format
+ workflowName: 'Source Code Tests'
+ message: >
+ Your code currently does not meet JabRef's code guidelines.
+ IntelliJ auto format covers some cases.
+ There seem to be issues with your code style and autoformat configuration.
+ Please reformat your code (Ctrl+Alt+L) and commit, then push.
+
+
+ In special cases, consider using `// formatter:off` and `// formatter:on` annotations to allow deviation from the code style.
- jobName: Checkstyle
workflowName: 'Source Code Tests'
message: >
diff --git a/.github/workflows/tests-code.yml b/.github/workflows/tests-code.yml
index 901526eeafc..6b126371337 100644
--- a/.github/workflows/tests-code.yml
+++ b/.github/workflows/tests-code.yml
@@ -114,6 +114,18 @@ jobs:
run: |
./gradlew --no-configuration-cache :rewriteDryRun
+ format:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v5
+ - uses: koppor/intellij-idea-format@update-to-latest-intellij
+ with:
+ file-mask: "*.java"
+ settings-file: "config/IntelliJ Code Style.xml"
+ # job should fail in case there are changes
+ - name: Check if any files changed
+ run: git diff --exit-code
+
modernizer:
name: Modernizer
runs-on: ubuntu-latest
diff --git a/config/IntelliJ Code Style.xml b/config/IntelliJ Code Style.xml
index 6cee9322160..dbe682cecbb 100644
--- a/config/IntelliJ Code Style.xml
+++ b/config/IntelliJ Code Style.xml
@@ -35,6 +35,7 @@
+
@@ -306,4 +307,4 @@
-
+
\ No newline at end of file
diff --git a/jablib/src/test/java/org/jabref/logic/exporter/CffExporterTest.java b/jablib/src/test/java/org/jabref/logic/exporter/CffExporterTest.java
index b98ceb8e263..2adbd77dfd1 100644
--- a/jablib/src/test/java/org/jabref/logic/exporter/CffExporterTest.java
+++ b/jablib/src/test/java/org/jabref/logic/exporter/CffExporterTest.java
@@ -1,4 +1,3 @@
-
package org.jabref.logic.exporter;
import java.io.IOException;
diff --git a/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java b/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java
index 777af811194..58974a038d4 100644
--- a/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java
+++ b/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java
@@ -1,4 +1,3 @@
-
package org.jabref.logic.formatter.bibtexfields;
import org.junit.jupiter.api.BeforeEach;
diff --git a/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java b/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java
index b6e233c846a..b91a144166f 100644
--- a/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java
+++ b/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java
@@ -1,4 +1,3 @@
-
package org.jabref.logic.formatter.bibtexfields;
import org.junit.jupiter.api.BeforeEach;
diff --git a/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java b/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java
index 48798526272..137e4e52bf0 100644
--- a/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java
+++ b/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java
@@ -1,4 +1,3 @@
-
package org.jabref.logic.formatter.bibtexfields;
import org.junit.jupiter.api.BeforeEach;