Skip to content

Feature Request: ignore @overload decorated objects #559

Open
@FelipeCybis

Description

@FelipeCybis

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 |
+-----------------------------------+----------------+---------+--------------------------------------+

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