-
Notifications
You must be signed in to change notification settings - Fork 3
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
Use Ruff, fix various tests #92
Conversation
You could consider adding RUF021, since you suggested it ;) But it's still in preview, so I think you'd have to add |
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. |
Funny, that's one of only two RUF one I have disabled in my config for 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 |
ignore = [ | ||
"ANN101", # missing type annotation for self in method | ||
"ANN102", # missing type annotation for cls in classmethod | ||
"SIM105", # I don't like contextlib.suppress |
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.
I always ignore UP038
because of astral-sh/ruff#7871, though it doesn't make much of a difference here since the rule only does things if your lowest supported version is Python 3.10
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.
Yeah I agree with you there, adding support for isinstance()
with UnionType was a questionable design choice in the first place. I'll add it to the exclude list and see if I still agree in two years' time when 3.9 goes EOL :)
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? |
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 :) |
No description provided.