-
Notifications
You must be signed in to change notification settings - Fork 371
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
MNT: Use ruff for formatting checks #2273
Conversation
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.
Makes sense to me. I tried it locally and in flies.
It looks like ruff will also autofix some white space problems. Does that mean that some of the smaller hooks are also redundant, or are they still needed for the non-python files?
https://docs.astral.sh/ruff/rules/#warning-w
Gridliner, | ||
classic_formatter, | ||
classic_locator, | ||
) |
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.
I think I prefer the old style here, as I like the horizontal separation between modules and their objects. I can't see a setting for that though, and it isn't a deal-breaker.
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.
I don't have a strong preference either way, so I was fine applying this. I think that ruff likely takes the black formatting approach and applies it liberally here even if we aren't using black. I also haven't found a setting to override this so I think we are stuck with it if we want to replace isort with ruff.
I think we can probably start slowly moving over to ruff for these. But, I wasn't 100% sure so I didn't apply that here. But, we can definitely start adding more codes as we see fit and removing the redundant checks. |
.pre-commit-config.yaml
Outdated
- repo: https://github.com/PyCQA/isort | ||
rev: "5.12.0" | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: 'v0.0.292' |
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.
v0.1.0 just dropped 👀
https://github.com/astral-sh/ruff/releases/tag/v0.1.0
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.
Bumped to v0.1.5 now.
Moves from flake8 and isort to ruff for the formatting checks. Also updates some of the sorted and formatted imports that were flagged by ruff.
Let's do this! |
Moves from flake8 and isort to ruff for the formatting checks. Also updates some of the sorted and formatted imports that were flagged by ruff. Ruff is significantly faster than flake8 / isort and we can also start adding additional checks later if we want. I looked at adding "D", but that is quite intimidating to update the docstrings right now with ~500-1k failures depending on which checks we want.