Skip to content

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

@12rambau

Description

@12rambau

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions