Idea: use ruff as a replacement for flake8 + isort ?#890
Conversation
ruff as a replacement for flake8 + isort ?ruff as a replacement for flake8 + isort ?
Codecov Report
@@ Coverage Diff @@
## main #890 +/- ##
=======================================
Coverage 92.96% 92.96%
=======================================
Files 50 50
Lines 2417 2417
=======================================
Hits 2247 2247
Misses 170 170 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
DominicOram
left a comment
There was a problem hiding this comment.
This worked for me but required a bit of faffing to get vscode happy. Had to change Python: Select Linter to None and install the ruff extension. @dperl-dls, do you have strong opinions on this? One issue is that we're now using a different formatter to dodal.
I agree if we decide to use this we should also do an equivalent migration on |
In which case we should probably ask @callumforrester |
|
I don't have a very strong opinion on this but I have noticed some slowdown with flake8 so I am mildly in favour |
|
@coretl, weren't you looking at migrating the skeleton to ruff at some point? |
|
we are planning to, but haven't had time yet: DiamondLightSource/python3-pip-skeleton#142 |
|
Is a better way to do this to change the skeleton then merge it in here and |
|
@Tom-Willemsen just volunteered to do this and I said yes please... |
f8ef4d2 to
f60d83a
Compare
|
This PR is now a cherry-pick/merge of DiamondLightSource/python3-pip-skeleton#147 . |
Test for adding
ruffas a replacement forflake8+isort.Main advantage is speed (approx 100x faster):
One code change is required due to a difference in opinion between ruff and
isortabout constructs like:which ruff prefers formatted as:
Other than that it is a 1:1 replacement in terms of linting rules.
This seems to be the direction a lot of modern python projects are moving in, and a better dev experience with
pre-commitetc is always nice.