pydocstyle icon indicating copy to clipboard operation
pydocstyle copied to clipboard

Fix issues with `typing.overload`

Open yumasheta opened this issue 4 years ago • 2 comments

This should fix #525 and also the def __init__() overloading which is not explicitly part of that issue. The fix simply makes use of the existing is_overload property also in the case that definition.is_magic is true. Previously, this was somehow missed in the inlined if-else construct. I expanded that part to more explicit statements and used a new variable.

I also tried #555 and at least added a match for "typing.overload". But I don't know if pydocstyle is able to infer if a decorator is actually a name bound at import by something like: from typing import overload as my_overload. If not, then I don't see a way to "know" if a given decorator is a typing.overload.

If this is ok, I'd add tests as well.

TODO:

  • [ ] Add unit tests and integration tests where applicable.
  • [ ] Add a line to the release notes (docs/release_notes.rst) under "Current Development Version".
    Make sure to include the PR number after you open and get one.

yumasheta avatar Jan 13 '22 18:01 yumasheta

I noticed a strange side effect. When using the changes of this PR, D105 is never detected.

yumasheta avatar Jan 17 '22 15:01 yumasheta

Should be fixed now. I missed that the evaluation of the error codes dict is delayed.

yumasheta avatar Jan 17 '22 16:01 yumasheta