Closed JelleZijlstra closed 7 months ago
I added the whole RUF series because why not. I really like RUF005; that's something I've often done manually.
Though come to think of it I should probably refactor that code that RUF005 changed since it deals with the old typeshed layout.
I added the whole RUF series because why not. I really like RUF005; that's something I've often done manually.
Funny, that's one of only two RUF one I have disabled in my config for typeshed-stats
😄 I'm not sure it always leads to faster code. But YMMV :)
The other RUF one I disable is RUF013 (because mypy already enforces that), and I disable the autofix for RUF017 (ruff chooses the fastest autofix, which uses functools.reduce
and operator.iadd
, but I prefer itertools.chain.from_iterable
, which is only a tiny bit slower and looks much cleaner IMO)
As for RUF005, I don't really care if it's marginally faster (if it's slower, just complain to Brandt :P), but I feel it makes the code look cleaner.
What's the disadvantage in having RUF013 on even if mypy also enforces it?
What's the disadvantage in having RUF013 on even if mypy also enforces it?
No real disadvantage, just my personal preference -- I just prefer to have the type checker complain about my types and ruff focus on other stuff :)
You could consider adding RUF021, since you suggested it ;)
But it's still in preview, so I think you'd have to add
preview = true
totool.ruff.lint
in yourpyproject.toml