[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.
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.
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.
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.