Repository navigation
Output the required formatting changes - #1216
Conversation
| run: ruff format --check . | ||
| - name: Run ruff checks on the files | ||
| run: ruff check --fix | ||
| run: ruff format . |
There was a problem hiding this comment.
I don't like automatic rewrites of PRs. Please don't do this.
There was a problem hiding this comment.
This does not rewrite a PR.
ruff format --check .
does not output anything.
In the end, the git diff prints the differences.
There was a problem hiding this comment.
You replaced that with:
run: ruff format .
which most certainly rewrites the PR.
There was a problem hiding this comment.
The next step will fail if the files have been formatted - not with a one-liner but with a more elaborate message for which a screenshot can be found in the PR head.
git status
git diff --exit-code
Even if the topic is charged in the other PR, it is ok to ask questions for understanding.
Since RUFF formatting is now required, I want to ease the development through proper error messages.
Pull Request Test Coverage Report for Build 22277536764Details
💛 - Coveralls |
|
I think, this could well solve some of the issues of the other PR #1208 DONE: Add a comment in the CI failure to
|
SashankBhamidi
left a comment
There was a problem hiding this comment.
Can be merged after changelog fix, thanks!
Also, see comment about ruff.
There was a problem hiding this comment.
Most projects in the ecosystem use the simpler standard pattern:
ruff format --check .
ruff check .Adding --output-format=github to both gives inline PR annotations, which may be better UX than the git diff approach:
- name: Run ruff formatter check
run: ruff format --check --output-format=github .
- name: Run ruff lint check
run: ruff check --output-format=github .The current ruff format . + git diff approach works and the diff is helpful, but it's non-standard. Worth considering whether the GitHub annotations would serve contributors better.
There was a problem hiding this comment.
Hm. Thanks for suggesting this.
I don't think that will help e.g. know that a newline should be added:
$ ruff format --check --output-format=github --preview .
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/__init__.py,line=181,endLine=183::src/icalendar/__init__.py:181:1: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/parser/string.py,line=35,endLine=175::src/icalendar/parser/string.py:35:13: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/prop/categories.py,line=29,endLine=34::src/icalendar/prop/categories.py:29:26: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/prop/factory.py,line=114,endLine=214::src/icalendar/prop/factory.py:114:30: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/prop/image.py,line=66,endLine=72::src/icalendar/prop/image.py:66:23: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/prop/recur/frequency.py,line=18,endLine=28::src/icalendar/prop/recur/frequency.py:18:32: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/prop/recur/recur.py,line=138,endLine=158::src/icalendar/prop/recur/recur.py:138:26: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/prop/recur/weekday.py,line=49,endLine=59::src/icalendar/prop/recur/weekday.py:49:30: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/attr/test_rdate.py,line=37,endLine=42::src/icalendar/tests/attr/test_rdate.py:37:22: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/prop/test_unit.py,line=126,endLine=133::src/icalendar/tests/prop/test_unit.py:126:18: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/prop/test_vPeriod.py,line=45,endLine=47::src/icalendar/tests/prop/test_vPeriod.py:45:17: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/rfc_6350_vcard/test_vAdr.py,line=50,endLine=95::src/icalendar/tests/rfc_6350_vcard/test_vAdr.py:50:20: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/rfc_7265_jcal/test_invalid_jcal.py,line=124,endLine=352::src/icalendar/tests/rfc_7265_jcal/test_invalid_jcal.py:124:29: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/rfc_7265_jcal/test_section_3_6_values.py,line=112,endLine=119::src/icalendar/tests/rfc_7265_jcal/test_section_3_6_values.py:112:16: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/test_cli_tool.py,line=43,col=17,endLine=43,endColumn=17::src/icalendar/tests/test_cli_tool.py:43:17: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/test_icalendar.py,line=154,endLine=228::src/icalendar/tests/test_icalendar.py:154:49: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/test_issue_821_stdin_parse.py,line=54,col=17,endLine=54,endColumn=17::src/icalendar/tests/test_issue_821_stdin_parse.py:54:17: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/test_period.py,line=45,endLine=67::src/icalendar/tests/test_period.py:45:36: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/test_property_params.py,line=26,endLine=64::src/icalendar/tests/test_property_params.py:26:24: unformatted: File would be reformatted
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/test_unit_cal.py,line=31,endLine=183::src/icalendar/tests/test_unit_cal.py:31:43: unformatted: File would be reformattedIf you have improvement ideas, could you open an issue for those?
test:
::error title=Ruff (unformatted),file=/home/nicco/icalendar/src/icalendar/tests/test_issue_821_stdin_parse.py,line=54,col=17,endLine=54,endColumn=17::src/icalendar/tests/test_issue_821_stdin_parse.py:54:17: unformatted: File would be reformatted
Co-authored-by: Sashank <hello@sashank.wiki>
|
Thanks for the review - from now on, it should be easier to guide newcomers to format their PRs. |
|
Yay! First PR and it is already useful: |
This PR cleans up the message from #1216. No change log needed.

Closes issue
When the formatting CI runs, it does not show what needs to be done to pass.
Description
This runs the ruff commands in a way that shows what needs changing.
Checklist
CHANGES.rst.