Skip to content
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

Error WPS428 for ellipsis in @overload functions #1777

Closed
vnmabus opened this issue Dec 16, 2020 · 3 comments
Closed

Error WPS428 for ellipsis in @overload functions #1777

vnmabus opened this issue Dec 16, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@vnmabus
Copy link

vnmabus commented Dec 16, 2020

Bug report

What's wrong

Functions decorated with the @overload decorator of the typing module should have an empty body, usually denoted with ellipsis, as in the default example:

@overload
def process(response: None) -> None:
    ...

However, WPS reports this usage as WPS428 Found statement that has no effect.

How it should be

Ellipsis should be accepted as the body of @overload functions.

@vnmabus vnmabus added the bug Something isn't working label Dec 16, 2020
@sobolevn
Copy link
Member

Yes, we prefer adding docstrings instead of ... in each overload. So, this allow us to tell why whould you need each of this cases.

Example: https://github.com/dry-python/returns/blob/master/returns/methods/cond.py#L20

@vnmabus
Copy link
Author

vnmabus commented Dec 17, 2020

Yes, we prefer adding docstrings instead of ... in each overload. So, this allow us to tell why whould you need each of this cases.

Example: https://github.com/dry-python/returns/blob/master/returns/methods/cond.py#L20

Sorry, but this goes against standard practice, and the next version of pydocstyle will even flag it as an error D418 (see PyCQA/pydocstyle#511).

@sobolevn
Copy link
Member

Thanks! I was not aware about this new rule in pydocstyle! We would need to swith off its rule for that.
I really believe that this solution is more readable than ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants