-
-
Notifications
You must be signed in to change notification settings - Fork 25
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: Switch from flake8 to ruff for linting #342
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.
Thanks! We could potentially also consider switching from black to ruff-format. I am using it in some other projects and the transition was flawless.
Switched to ruff-format and removed unnecessary |
Maybe add |
- id: flake8 | ||
language: python_venv | ||
- id: ruff | ||
- id: ruff-format |
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.
Should we put the formatter first? (eg I can imagine that the linter complains about a too long line, which would already be solved by the formatter afterwards)
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.
Sure; was just following the example.
I'm assuming we don't want to auto-fix lint errors, which is where putting the linter first is recommended.
Of course if you don't use pre-commit and want to run ruff manually, you also need it in your env. |
I personally use visual studio code and then it is convenient that formatter and linter are installed so the formatting is automatically applied and linting errors are shown in the UI. Once you commit pre-commit will check this as well... but this is later in the process. But, if this is rather typical for my workflow, no problem not to include it... not problem to install it myself... |
Given that we had |
I don't mind ruff being there in the dev env file (I don't use that anyway, I have a "geo-dev" env that I use for geopandas etc as well), but just a note for those using it: you might have to take care in ensuring the same ruff version is used as in the pre-commit, otherwise you might still get lint failures on CI. |
Resolves #341
Similar to changes in GeoPandas #2921 but without needing to configure additional rules.