Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: ignore @overload decorated objects #559

Open
FelipeCybis opened this issue May 22, 2024 · 0 comments
Open

Feature Request: ignore @overload decorated objects #559

FelipeCybis opened this issue May 22, 2024 · 0 comments

Comments

@FelipeCybis
Copy link

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 |
+-----------------------------------+----------------+---------+--------------------------------------+
@FelipeCybis FelipeCybis changed the title FR: ignore @overload decorated objects Feature Request: ignore @overload decorated objects May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant