Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

How to fix error D213? #242

@htiga

Description

@htiga

I find that no matter how I write multi-line docstring, there is an error D213. Even the source code of pydocstyle itself below: source code of pydocstyle that raises D213. Is this a bug or do I miss anything?

def check_multi_line_summary_start(self, definition, docstring):
    """D21{2,3}: Multi-line docstring summary style check.

    A multi-line docstring summary should start either at the first,
    or separately at the second line of a docstring.

    """
    if docstring:
        start_triple = [
            '"""', "'''",
            'u"""', "u'''",
            'r"""', "r'''",
            'ur"""', "ur'''"
        ]

        lines = ast.literal_eval(docstring).split('\n')
        if len(lines) > 1:
            first = docstring.split("\n")[0].strip().lower()
            if first in start_triple:
                return violations.D212()
            else:
                return violations.D213()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions