New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MAINTENANCE] Replace black
formatter with ruff format
#9536
Conversation
black
formatter with ruff format
black
formatter with ruff format
✅ Deploy Preview for niobium-lead-7998 canceled.
|
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I'm happy with this change. I think we need to do a few things before merging:
- Add file ignores
- Add #noqa back
- Update PR autopopulated message to remove mention of
black
- I also added comments to the toml file for rules I'd like to be turned on if possible
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# fmt: off
outside of the top-level/statement level is a known issue with the ruff
formatter
- Formatter seems to ignore
#fmt: off
astral-sh/ruff#9588 - fmt: off doesn't work in
parametrized
decorator astral-sh/ruff#9875
Can fix this by de-denting the # fmt: off
comment or by adding a trailing # fmt: skip
, but these will disable formatting for more than just the parameter values.
Edit:
Addressed with # fmt: skip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM!
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Replacing the
black
formatter withruff format
https://docs.astral.sh/ruff/formatter/
Deviations from Black (Explanation and Examples)
Note:
Some of the changes in this PR are because
ruff format
is copying a more recent version of black24.2.0
, whereas we had been stuck on23.11.0
Update Ruff
0.2.2
->0.3.0
https://github.com/astral-sh/ruff/releases/tag/v0.3.0
TODO
If we decide to adopt this formatter I will...
noqa
comments..gitblame-ignore-revs
entrySee also