Skip to content

Commit c88c1bd

Browse files
Merge pull request #1216 from niccokunzmann/ruff-show-difference-ci
Output the required formatting changes
2 parents 78bcedd + 360b81e commit c88c1bd

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎.github/workflows/ruff.yml‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ on: [push, pull_request]
33
jobs:
44
ruff:
55
runs-on: ubuntu-latest
6+
env:
7+
MESSAGE: |
8+
Your code is not formatted!
9+
Please setup your development environment and run the formatting command.
10+
https://icalendar.readthedocs.io/en/stable/contribute/development.html#code-format
611
steps:
712
- uses: actions/checkout@v6
813
- name: Set up Python
@@ -15,10 +20,17 @@ jobs:
1520
python -m pip install --upgrade pip
1621
pip install . --group formatting
1722
- name: Run the ruff formatter to change files
18-
run: ruff format --check .
19-
- name: Run ruff checks on the files
20-
run: ruff check --fix
23+
run: ruff format .
2124
- name: Fail if we detect any changes on the file system
2225
run: |
2326
git status
24-
git diff --exit-code
27+
if ! git diff --exit-code; then
28+
echo "$MESSAGE"
29+
exit 1;
30+
fi
31+
- name: Run ruff checks on the files
32+
run: |
33+
if ! ruff check; then
34+
echo "$MESSAGE"
35+
exit 1;
36+
fi

‎CHANGES.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ We still recommend checking out the new features and giving feedback in the repo
2727
Minor changes
2828
~~~~~~~~~~~~~
2929

30+
- Show required code changes in the CI output to help contributors solve the formatting issues. :pr:`1216`
3031
- Use ruff 0.15.0 for code formatting in :file:`tox.ini`. :pr:`1215`
3132

3233
Breaking changes

0 commit comments

Comments
 (0)