python-trio / flake8-async

Highly opinionated linter for Trio code
https://flake8-async.readthedocs.io
MIT License
17 stars 2 forks source link

replace flake8-eradicate with ruff ... and enable a ton of more lint rules, fixing a couple of them. #196

Closed jakkdl closed 1 year ago

jakkdl commented 1 year ago

If enabling auto-updating of pre-commit, flake8-eradicate will come to bite us as it's not accepting PR's to show that it works with flake8 6. I was planning to add an updated fork as additional_dependency to flake8 instead, but I stumbled upon https://github.com/charliermarsh/ruff instead - which, among others, reimplements flake8-eradicate. Curiosity peaked, I added it to CI, enabled everything (it sucks there's no --select-all), and after playing around for a bit it looks to be almost strictly better than flake8 in a lot of ways. It implements a ton of plugins by default, has autofix for a bunch of them, and in general very easy to transition to from flake8.

flake8-mutable is the only plugin flake8-trio uses I didn't see listed in https://github.com/charliermarsh/ruff#rules (though maybe there is a rule for default mutable arguments anyway, haven't checked), and flake8-noqa (but there is support for checking noqa stuff). Looks like they haven't kept up reimplementing all rules from flake8-bugbear (esp not from the opinionated ones), but majority of them are in.

So might be interesting to enable it, and see how viable it is as a replacement for flake8.

jakkdl commented 1 year ago

IMO we could drop the flake8 checks immediately, if there's nothing else left out?

I don't mind running both for a while to see where they agree/disagree. But if it becomes bothersome I'll quickly start disabling error codes/plugins, set the stage for flake8 to manual, and/or remove it.

jakkdl commented 1 year ago

ah shoot, I was just a few minutes off pushing another minor change to this x) I'll do it in a separate PR~