Add ruff linter and formatter to pre-commit#856
Merged
vgrozdanic merged 4 commits intomasterfrom Jan 13, 2025
Merged
Conversation
e05f7f0 to
da302bf
Compare
vgrozdanic
commented
Jan 13, 2025
Contributor
Author
There was a problem hiding this comment.
After adding ruff linter/formatter to pre-commit, this was auto formatted. I can separate this change into another PR before merging this, but since this is only one change, i have bundled it with this PR
vgrozdanic
commented
Jan 13, 2025
| hooks: | ||
| - id: ruff | ||
| types_or: [ python, pyi ] | ||
| args: [--select, I, --fix,] |
Contributor
Author
There was a problem hiding this comment.
ruff has imports sorting as a part of linter, not formatter, so we need --select I here to force imports sorting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In the past 2 PRs that i have opened, i have used linter locally to double check the changes and that i haven't forgotten something. I thing all of the devs (of this library) would benefit from having the linter as a part of
pre-commithooks to quickly get the feedback about potential problems in code :)I have no hard opinions about this specific linter or formatter, but
ruffis fast, and it is very easy to setup. I have been usingruffin a few of my personal projects and i really like it, so i have opened a PR to add it to this repo too.In addition to adding the new linter and formatter, I have also updated
extras_requireinsetup.pysince it contained unused packages, and it didn't list all of the packages that are being actively used.