-
Notifications
You must be signed in to change notification settings - Fork 739
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
Enable+apply isort via ruff/pre-commit #1871
Conversation
- repo: https://github.com/psf/black | ||
rev: 24.8.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/astral-sh/ruff-pre-commit |
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.
wasn't ruff enabled in the previous commit? Do you know why it did not it apply isort previously?
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.
yes, but the previous PR only enabled the F
ruleset, see https://github.com/Consensys/mythril/blob/develop/pyproject.toml#L7 ... to find and remove unused code/imports.
ruff has many more rules that can be activated, see https://docs.astral.sh/ruff/rules/
This PR enables isort by adding the I
to the activated rules, see https://github.com/dbast/mythril/blob/isort/pyproject.toml#L7
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 mean, I don't see that in this PR. Is the I
in a different PR?
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.
nvm, found it,
Github compressed some files for me
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 for the contribution!
This enables isort via ruff/pre-commit and applies it fully automatically (no manual changes), which results in sorting of the imports (no additions or removals).
While this looks like a cosmetic thing, the intention is different:
This now also runs the black hook after ruff, as reordering imports can result in some work for black.