Feature Request: ignore @overload decorated objects
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 355
- Forks
- 181
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 3
Description
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 |
+-----------------------------------+----------------+---------+--------------------------------------+
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running numpydoc lint file.py --ignore ES01 SA01 EX01 GL01 against the overload example in the issue and trace the GL08 reports for the decorated functions. Update the lint behavior so overloaded declarations do not raise missing-docstring errors, while the implemented function remains checked, and add or run coverage for this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100