Search code examples
pythondocstring

What is the reason for D407 error raised by Pydocstyle?


I am using pydocstyle and I wonder why it raises the error D407 / Missing dashed underline after section ('Example') against my code.

My code looks like this:

def foo():
    """
    Function description here...

    Example:
        Some example here...
    """
    # some code here

I had similar problem in the past when I tried to add Note: section. I wonder whether it is False-Positive error as I am using reStructuredText and I know that pydocstyle sometimes has problems to distinguish reST with Google and numpy styling. Please correct me if I am wrong, but isn't reST related to section pep257 described under Default conventions so I could literally turn off all these checks: D203, D212, D213, ..., D407, ...?


Solution

  • It appears that my hunch was right and D407 is one of errors that is not related to reStructuredText.

    Note: (same with Example:) section is unused in reStructuredText as ..note:: shall be used instead.