Skip to content

Inconsistent behavior in D405 with capitalization in Google docstrings #15224

@mgilson

Description

@mgilson

Consider the following simple snippet:

def func(a: int) -> int:
    """A docstring.

    args:
        a: an integer.

    returns:
        An integer.
    """
    return a

This triggers a D405 warning on line 4 -- it's unhappy that args: isn't Args:. However, it does NOT trigger a similar warning for the returns: section. If we get rid of the Args section then a D405 error is reported.

def func(a: int) -> int:
    """A docstring.

    returns:
        An integer.
    """
    return a

I suspect that this is a bug (I wouldn't expect the presence of one section to have any impact on whether that section should be capitalized).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocstringRelated to docstring linting or formatting

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions