numpy/numpydoc

Feature Request: ignore @overload decorated objects

FelipeCybis opened this issue · 0 comments

Overloaded functions should not have docstrings as the docstrings should be in the implemented function.

Maybe I missed something, but is there a way to ignore all @overload decorated functions?

This file should not raise any errors

"""File docstring."""

from typing import overload

@overload
def hello(a: str) -> str: ...

@overload
def hello(a: int) -> int: ...

def hello(a: str | int) -> str | int:
    """Return a.

    Parameters
    ----------
    a : int or str
        Parameter a.
    
    Returns
    -------
    int or str
        Returns a.
    """

    return a

numpydoc lint file.py --ignore ES01 SA01 EX01 GL01 does raise this

+-----------------------------------+----------------+---------+--------------------------------------+
| file                              | item           | check   | description                          |
+===================================+================+=========+======================================+
| .\src\test_numpydoc\__init__.py:6 | __init__.hello | GL08    | The object does not have a docstring |
+-----------------------------------+----------------+---------+--------------------------------------+
| .\src\test_numpydoc\__init__.py:9 | __init__.hello | GL08    | The object does not have a docstring |
+-----------------------------------+----------------+---------+--------------------------------------+