-
Notifications
You must be signed in to change notification settings - Fork 423
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
Look into ruff rule RUF012 #1408
Comments
As for
Agreed. |
I think it is actually a bug, we did not encounter problem mostly because BTW, I notice that you have proposed many ruff rules, just wonder whehter there is any recommended rule set? AFAIK, there is no preset. |
While ruff enables the following set of rules by default, other rules are indeed useful:
It is hard to suggest a default set of rules. There is no wide enough consensus to balance the individual preferences of maintainers. I've seen maintainers revert from ruff to flake8 because ruff is not totally a drop-in replacement of flake8, and other maintainers embrace ruff and enable The rules I have suggested so far reveal actual bugs or result undeniably(?) in more readable or faster code. |
Do not get me wrong, I am trying to learn about a recommended rule set. :-) |
How would this feature be useful?
RUF012
checks for mutable default values in class attributes:Introduced in #610:
pipx/src/pipx/animate.py
Lines 23 to 24 in 5eed479
Introduced in #222:
pipx/src/pipx/pipx_metadata_file.py
Lines 29 to 44 in 5eed479
Describe the solution you'd like
As a first step, I'd like to understand whether this is on purpose or not.
I suspect the relevant classes are designed to have one instance, in which case this is not an issue in practice. Nevertheless, it's good practice to avoid mutable default values, so that future maintainers don't have to ask themselves again.
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: