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 @@