-
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
[pylint
] Implement singledispatch-method
(E1519
)
#10140
[pylint
] Implement singledispatch-method
(E1519
)
#10140
Conversation
bf7f97b
to
3a5e666
Compare
3a5e666
to
3111e95
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR0917 | 2 | 0 | 2 | 0 | 0 |
PLR0904 | 1 | 0 | 1 | 0 | 0 |
/// Checks for singledispatch decorators on class methods. | ||
/// | ||
/// ## Why is this bad? | ||
/// Single dispatch must happen on the type of first non self argument |
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.
Example code is helpful here. Take a look at other rules to see the format. The pylint docs contains examples to use.
You can also link the Python documentation of singledispatchmethod
|
||
@singledispatch # [singledispatch-method] | ||
def move(self, position): | ||
pass |
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.
Is it possible to catch @funcname.register as the pylint rule does?
Even if not, it would be good to include those examples in the tests in case we can do it in the future.
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.
Probably a bit harder (but possible) to catch @funcname.register
, but agree we should add tests for it with commentary.
pylint
] Implement singledispatch-method
(E1519
)
Gonna address feedback and merge. |
1c52b00
to
1dbb6ae
Compare
1dbb6ae
to
6702c4d
Compare
3d75d73
to
c814776
Compare
Thanks for addressing the comments 😃 |
Implementing the rule https://pylint.readthedocs.io/en/stable/user_guide/messages/error/singledispatch-method.html#singledispatch-method-e1519 Implementation simply checks the function type and name of the decorators.
Implementing the rule
https://pylint.readthedocs.io/en/stable/user_guide/messages/error/singledispatch-method.html#singledispatch-method-e1519
Implementation simply checks the function type and name of the decorators.