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

Split Java code style checks #10532

Merged
merged 2 commits into from
Oct 21, 2023
Merged
Changes from 1 commit
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
59 changes: 57 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ concurrency:

jobs:
checkstyle:
name: Code style check
name: Checkstyle
runs-on: ubuntu-latest
steps:
- name: Checkout source
Expand Down Expand Up @@ -52,22 +52,77 @@ jobs:
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [Checkstyle](https://checkstyle.sourceforge.io/) to identify issues.
The tool reviewdog already placed comments on GitHub to indicate the places. See the tab "Files" in you PR.
Please carefully follow [the setup guide for the codestyle](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html).
Afterwards, please run checkstyle locally and fix the issues.


More information on code quality in JabRef is available at <https://devdocs.jabref.org/getting-into-the-code/development-strategy.html>.
comment_tag: checkstyle
reactions: eyes
openrewrite:
name: OpenRewrite
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
cache: 'gradle'
- name: Run OpenRewrite
run: |
./gradlew rewriteDryRun
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [OpenRewrite](https://docs.openrewrite.org/) to ensure "modern" Java coding practices.
The issues found can be **automatically fixed**.
Please execute the gradle task *`rewriteRun`*, check the results, commit, and push.


You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".
comment_tag: openrewrite
modernizer:
name: Modernizer
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
cache: 'gradle'
- name: Run modernizer
run: |
# enable failing of this task if modernizer complains
sed -i "s/failOnViolations = false/failOnViolations = true/" build.gradle
./gradlew modernizer
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [Gradle Modernizer Plugin](https://github.com/andygoossens/gradle-modernizer-plugin#gradle-modernizer-plugin) to ensure "modern" Java coding practices.
Please fix the detected errors, commit, and push.


You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "Modernizer".
comment_tag: modernizer
markdown-checks:
name: Markdown style check
runs-on: ubuntu-latest
Expand Down
Loading