-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
R0903 should consider nontrivial __init__ #8976
Comments
Dundee methods aren't considered public. It would be very hard to determine when there is "sufficient" logic to consider Sorry but I don't think we will implement this. |
I think closing this issue just now without a bit of discussion is a bit premature. |
Another example of metric: Depth of nested loops and conditionals: Functions with deeper nested loops and conditionals are likely to have more complex logic |
The issue is that we need to maintain it later. So we'd accept this PR and then we have someone else that want to actually want to consider non-trivial |
At least in terms of the current Pylint logic, I think that isn't correct. See this comment and the following lines.
class PrivateMethodsOnly:
def __str__(self):
return f"class name: {self.__class__}"
def __repr__(self):
return "hello" pylint example.py --disable=all --enable=too-few-public-methods
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00) |
Wow.. I guess I would consider that a bug 😄 Either way, I'm against determining inclusion based on some heuristic of "non-trivialness". Whether all other dunder methods should be included is something for another issue I guess. |
Bug description
I think that R0903 should not be triggered when there is a public method AND an
__init__
method containing code/logic, since it is indeed another public method.for example:
Configuration
No response
Command used
Pylint output
Expected behavior
__init__
should be considered a public method too.Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: