Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reformats the entire codebase using
ruff format
, which is almost identical toblack
's formatting:https://docs.astral.sh/ruff/formatter/
For now, I've split the reformat changes into multiple commits, but I will squash them before merging, so the one giant commit can be added to
.git-blame-ignore-revs
afterwards. Having multiple commits is easier to review, because the diff shortstat is currently this:257 files changed, 9880 insertions(+), 7909 deletions(-)
Instead of just running
ruff format
, the reformatting was done by using PyCharm with ruff's lsp set up, so there's probably some additional PyCharm reformatting logic included, not sure, but doesn't matter.I've also had to skip the formatting in lots of places (
# fmt: skip
annotation after a whole statement), because tooling is usually not smart and the formatting often was chosen deliberately in order to highlight certain circumstances or to make it more legible.Most of the diff is only indentation related though. For example, almost all of the pytest parametrization didn't align its parameters according to the expected style, in order to prevent one indentation level. That's all changed and trivial to review.
Another huge part of the diff are plugins of course. I tried to keep a common style of the pluginmatchers and their non-verbose regexes, but the annoying things here are HTTP requests with validation schemas, which almost all of them required a reformatting due to the parameter style of function calls with multi-line parameter values. Most of that is of course also only indentation, with new trailing commas added.
Apart from that, I believe I also changed/rearranged a few minor things here and there. Can't remember.
This PR also adds
ruff format --diff
to the linting CI workflow, so using the correct coding style is now mandatory. The docs were updated in this regard.One thing that needs to be mentioned though is that there are two linting rules which we use which are incompatible with the formatter's auto-fix logic, namely
COM812
ISC001
This doesn't affect its check logic (
--check
/--diff
) and triggers errors in the linter, which is therefore fine.Another thing worth mentioning is that the formatter uses ruff's "preview" rules. Those will only be changed in their minor releases though. And since we're pinning the ruff version, there's nothing to worry anyway.
I will go through the diff tomorrow again, in case I made some mistakes, and then merge.