-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Move no-self-use
to optional checker
#5502
Comments
Totally agree, I'm always disabling it myself. But isn't this issue a small subpart of #3512 though ? (On mobile so I added the number by memory, the issue might not be the right one, it should be disabling some message by default) AWhetter made a list of what we should do for all messages basically, I would appreciate your opinion on this. |
Hm, I wonder, instead of disabling it, would it make sense to inspect the entire class hierarchy? For example:
Why? I want to be reminded if neither version of a method uses the But I guess if that's too complicated or comes with a million other caveats, disabling it wouldn't be a huge loss. |
@derula Unfortunately, we can only check parent / base classes since there are no references to possible child or sibling classes. Usually however, it's a method in parent class for which the All in all I think the added value is quite minimal in which case it's more important to prevent false-positives than false-negatives. Especially when the Moving the check to an optional checker would allow anyone who wants to, to continue using it. |
The "no-self-use" Pylint checker has been moved to optional extension by pylint-dev/pylint#5502.
It's been moved to optional checker and we won't activate it. Was not really useful and switching to static methods in all places would carry other interesting problems and no positives as shown in: pylint-dev/pylint#5502
It's been moved to optional checker and we won't activate it. Was not really useful and switching to static methods in all places would carry other interesting problems and no positives as shown in: pylint-dev/pylint#5502
Related #5496
I recently came across code like this
Although
get_email
is only ever called on an instance, the author choose to add thestaticmethod
decorator. I believe, just so pylint wouldn't complain aboutno-self-use
.With #5412 this will however now emit a
arguments-differ
warning onChild.get_email
(with and withoutstaticmethod
).Proposal
I would like to propose moving
no-self-use
to an optional checker.Reason
Although this check might be helpful in some instances, usually not using
self
is no indication that a method should bestatic
. As shown in the example, sometimes this leads to devs writing worse code just to satisfy pylint instead of addingpylint: disable
.The text was updated successfully, but these errors were encountered: