ci: add ruff for print checks - #1666
Conversation
Hofer-Julian
left a comment
There was a problem hiding this comment.
Thanks, looks good in general.
|
What's missing to move this forward? |
Just a few minor changes:
|
|
It would be great if you could seperate your changes from the autogenerated ones. This allow excluding the latter from git blame. |
You mean make all config changes, skip pre-commit and push directly?
Oh, shouldn't git blame just blame me for the empty lines, and the other stuff remains the same? |
Maybe run pre-commit on the config changes before committing those.
Are you talking about the changes by rust?
I didn't look into the exact changes prior to writing my comment. This is just the general process of changing autoformatter configs. However rust didn't only add new lines I think. |
ruff 😅 So you mean I should make 2 commits right - one with my changes and the other one with ruff's changes? |
Yes |
a4e9b92 to
5d8073b
Compare
|
Config changes - 5d8073b. |
Looking good. After resolving merge conflicts (I think rebasing makes the most sense) I would squash the first two commits. Then a commit can be created that adds |
|
Tried doing that, but I think I messed something up here - https://github.com/borgbase/vorta/compare/master...diivi:test-ruff-commits?expand=1. |
|
9c814f9 to
a7d6ed0
Compare
|
Done, thanks! |
|
This changes almost all the files by changing some formatting. Please only add the actual changes. If formatting settings change, this can be a separate PR. Else I can't really combine this with the qt6 PR, which also touches many files. |
|
So only d451c1d |
a7d6ed0 to
d451c1d
Compare
|
Merging this without the commit containing the formatting changes will break ci afaik. |
|
Wasn't this to find print statements when it started? 😀 And wasn't Black doing the formatting? Can't we just keep the same settings? Anyways, if everything needs to be reformatted again, I suggest to just add your config changes and apply the formatting later when there aren't many pending PRs. Better to rerun the formatter than deal with all the conflicts. |
Yeah, now it's about replacing isort with ruff too 😅 #1666 (comment) |
|
Understood. Then I suggest this:
|
|
#1685 is merged. So good to proceed here and add the formatting changes needed. |
|
Does everyone approve this PR? Then I'll take care of merging this correctly. |
|
Good to go! Formatting change separate, if possible. 🙏 |
I am planning on fast forwarding master with 3 commits corresponding to the commits of this PR. |
| flake8 | ||
| isort --check-only . | ||
| black --check . | ||
| ruff check . --fix |
There was a problem hiding this comment.
Why --fix? This is intended as a check only. That's why black is run with --check.
|
|
||
| - repo: https://github.com/charliermarsh/ruff-pre-commit | ||
| rev: 'v0.0.257' | ||
| hooks: |
There was a problem hiding this comment.
I'd prefer running the pre-commit hook with --fix.
Adds ruff replacing isort. Ruff comes with all flake8 rules and additional rules for print statements. * .github/workflows/test.yml : Replace isort with ruff in comment * .editorconfig : Update `yml` config to apply to all yaml files. * Makefile (lint): Run ruff, remove isort * .pre-commit-config.yaml : Remove isort, run ruff * pyproject.toml : Configure ruff. Remove isort config. * requirements.d/dev.txt : Add ruff, remove isort * setup.cfg : Extend flake8 file ignore * src/vorta/__main__.py : Add *noqa* for print statement.
Includes all changes by `pre-commit --all-files` including the changes introduced by ruff.
* .git-blame-ignore-revs
e333c65 to
82270ad
Compare
Description
Recently committed a print statement, which reminded me of #1612 (comment)
Screenshots (if appropriate):
Types of changes
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.