Enforcing argument and return documentation in the docstring

633 Views Asked by At

I'm trying to add a linter to a repo that would enforce docstring documentation of arguments and return values for functions and methods, as described in the Google Python Style Guide.

In general, I want to enforce the following docstring content:

def blah(n: int) -> int:
    """
    Args:
        n: a number
    
    Returns:
        The number plus 1
    """
    return n+1

I looked into YAPF, Google's own Python formatting tool, but could not find a configuration argument and return values. A broader search on this subject did not yield anything.

How can I enforce argument and return value documentation in a docstring using a linter?

0

There are 0 best solutions below