Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
78 changes: 39 additions & 39 deletions .github/workflows/javaCodestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,46 +74,46 @@ jobs:
- name: Run Checkstyle
run: mvn -ntp -B -Dcheckstyle.skip=false checkstyle:check

java_format:
name: Java Format Check
# line-scoped to the PR diff -> needs the pull_request base commit
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v7
with:
fetch-depth: 0
# java_format:
# name: Java Format Check
# # line-scoped to the PR diff -> needs the pull_request base commit
# if: github.event_name == 'pull_request'
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v7
# with:
# fetch-depth: 0

- name: Setup Java 17 adopt
uses: actions/setup-java@v5
with:
distribution: adopt
java-version: '17'
cache: 'maven'
# - name: Setup Java 17 adopt
# uses: actions/setup-java@v5
# with:
# distribution: adopt
# java-version: '17'
# cache: 'maven'

- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: '3.11'
# - name: Setup Python
# uses: actions/setup-python@v7
# with:
# python-version: '3.11'

- name: Unit-test the format checker
run: |
python -m pip install --quiet pytest
python -m pytest dev/tests -q
# - name: Unit-test the format checker
# run: |
# python -m pip install --quiet pytest
# python -m pytest dev/tests -q

- name: Check formatting of PR-edited lines
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
# Fails only if the Eclipse formatter would change a line this PR edited.
# See dev/format_changed.py for the line-scoping logic.
if ! python3 dev/format_changed.py --check "$BASE_SHA"; then
echo "::error::Some lines edited by this PR are not formatted per dev/CodeStyle_eclipse.xml."
echo "Fix only your edited lines locally and commit the result:"
echo ""
echo " dev/format-changed.sh"
echo ""
echo "(Do NOT run a bare 'mvn formatter:format' -- it reformats the whole tree.)"
exit 1
fi
# - name: Check formatting of PR-edited lines
# env:
# BASE_SHA: ${{ github.event.pull_request.base.sha }}
# run: |
# # Fails only if the Eclipse formatter would change a line this PR edited.
# # See dev/format_changed.py for the line-scoping logic.
# if ! python3 dev/format_changed.py --check "$BASE_SHA"; then
# echo "::error::Some lines edited by this PR are not formatted per dev/CodeStyle_eclipse.xml."
# echo "Fix only your edited lines locally and commit the result:"
# echo ""
# echo " dev/format-changed.sh"
# echo ""
# echo "(Do NOT run a bare 'mvn formatter:format' -- it reformats the whole tree.)"
# exit 1
# fi
12 changes: 10 additions & 2 deletions dev/format-changed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
#
set -euo pipefail

cd "$(git rev-parse --show-toplevel)"
if [ $# -ne 0 ]; then
if [[ "$1" == "--force" ]]; then
shift;
echo "Please check the resulting changes very carefully, as they might contain undesired modifications to the code.";
cd "$(git rev-parse --show-toplevel)";
exec python3 dev/format_changed.py --fix "$@";
fi
fi

exec python3 dev/format_changed.py --fix "$@"
echo "The formatting script is currently not supported, as it performs undesired modifications of code. You can still run this script with the '--force' flag. However, please double check the results very carefully." >&2;
exit 1;
Loading