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

useless-type-doc issued for undocumented parameters that have PEP484 type annotations #4593

Closed
finite-state-machine opened this issue Jun 18, 2021 · 0 comments · Fixed by #4614
Labels
Enhancement ✨ Improvement to a component False Positive 🦟 A message is emitted but nothing is wrong with the code
Milestone

Comments

@finite-state-machine
Copy link

This likely relates to (and solves) issue #4117.

Steps to reproduce

Call pylint with the docparams extension enabled on the following code:

'''demonstrate FP with useless-type-doc'''

def function(public_param: int, _some_private_param: bool = False) -> None:
    '''does things

    Args:
        public_param: an ordinary parameter
    '''
    for _ in range(public_param):
        ...
    if _some_private_param:
        ...
    else:
        ...

Current behavior

$ python3 -m pylint --load-plugins=pylint.extensions.docparams --rcfile=/dev/null bug.py
************* Module bug
bug.py:4:0: W9020: "_some_private_param" useless ignored parameter type documentation (useless-type-doc)

------------------------------------------------------------------
Your code has been rated at 8.33/10 (previous run: 5.00/10, +3.33)

Expected behavior

Pylint should issue no errors.

It would be reasonable for pylint to issue this error if the type information appeared in the docstring, however, pylint is actually responding to the type annotation (as in PEP484). The docparams module should only issue errors in response to docstrings (or lack thereof), and not PEP484 annotations.

pylint --version output

Result of pylint --version output:

pylint 2.8.1
astroid 2.5.6
Python 3.8.3 (default, Jul  6 2020, 09:12:34)
[Clang 10.0.1 (clang-1001.0.46.4)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants