PyCQA / pydocstyle

docstring style checker
http://pydocstyle.org
MIT License
1.11k stars 188 forks source link

Fix decorator parsing for async functions #577

Closed cdce8p closed 1 year ago

cdce8p commented 2 years ago

This PR addresses an issue with parsing decorators right before async function definitions. A good example to illustrate the issue is overload.

from typing import overload

@overload
async def func(x: int) -> int:
    ...

async def func(x: int | str) -> int | str:
    """Do something."""
    pass

At the moment, this would emit a D103 error for the first definition.

D103: Missing docstring in public function

That's because, parsing the decorator name wasn't stopped with async and thus overload became overloadasync and didn't match any is_overload checks anymore.

cdce8p commented 1 year ago

Moved the changelog entry again, since I didn't saw that 6.2.1 was released an hour ago.