tantale / deprecated

Python @deprecated decorator to deprecate old python classes, functions or methods.
MIT License
298 stars 32 forks source link

docstring that starts on the first line get wrongly indented #60

Closed 12rambau closed 1 year ago

12rambau commented 1 year ago

Expected Behavior

Whatever the convention I select for pydocstring (D212: start on the first line or D213: start on second line) I should get the same results when building documentation with Sphinx. I found out that if I use D212 (default behaviour for ruff) in combination with deprecated, then the indetation is shifted and the parameters are interpreted as quotes.

I created a small repository that you can launch by executing "nox" from the root. that shows the behavior.

This works as expected:

@versionadded(version="0.0.1", reason="because")
def titi (a, b) -> None:
    """
    A one line short description

    pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum

    Args:
        a: the first parameter
        b: a second parameter

    Returns:
        nothing
    """

    return

but this doesn't:

@versionadded(version="0.0.1", reason="because")
def tutu (a, b) -> None:
    """A one line short description

    pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum pim pam poum

    Args:
        a: the first parameter
        b: a second parameter

    Returns:
        nothing
    """

    return

see this RDT page for the result.