Swap out Flake8 for ruff in linting #232
Merged
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.
Ticket
Resolves #107
Changes
Change our linter from flake8 to ruff
Python package updates
Context for reviewers
ruff is a linter built in Rust that is both better performing and contains much more options than flake8 (including many of the Flake8 rules).
Ruff has a lot of potential rules we could configure, but to keep things simple, I ported over the same rules that we already had configured. If we want to try out any of the other rules, we can follow up with that. For context, enabling all rules causes ~1300 errors, although many of the common ones I see are not issues I think we would want to actually consider (complaining about using
assert
in test functions)Ruff can also serve as a formatter of code, potentially replacing black + isort, but I'll explore using that later as the change is likely much bigger as it would cause a lot of little formatting differences
Testing
Was able to run ruff via
make lint-ruff
and only encountered a few small issues that I fixed.We also switched to using this approach a few months ago in the simpler grants codebase and haven't run into any issues. HHS/simpler-grants-gov#1626