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

@overload causes missing-param-doc despite parameter being documented #9739

Closed
finite-state-machine opened this issue Jun 20, 2024 · 1 comment · Fixed by #9740
Closed

@overload causes missing-param-doc despite parameter being documented #9739

finite-state-machine opened this issue Jun 20, 2024 · 1 comment · Fixed by #9740
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@finite-state-machine
Copy link

finite-state-machine commented Jun 20, 2024

Bug description

Analyzing the following code with pylint, using the given rcfile, results in an unexpected missing-param-doc error:

'''module docstring
'''
from __future__ import annotations

from typing import (
        Iterable,
        Optional,
        overload,
        )

# pylint: disable-next=too-few-public-methods
class SomeClass:
    '''this docstring must be present
    '''
    @overload
    def __init__(self, _iterable: Iterable[object], /) -> None: ...
    @overload
    def __init__(self, /) -> None: ...

    def __init__(
            self, _iterable: Optional[Iterable[object]] = None, /
            ):
        '''constructor

        Args:
            _iterable: if specified, this must be an iterable of
                elements which will become the initial contents of this
                set
        '''
        _ = _iterable

Configuration

[MAIN]

load-plugins=pylint.extensions.docparams

[BASIC]

no-docstring-rgx=^(__(?!(init|new|call)__)\w+__|test_|mypy_|some_function)

[PARAMETER_DOCUMENTATION]

accept-no-param-doc=no
default-docstring-type=google

[VARIABLES]

ignored-argument-names=^ignored_|^unused_

Command used

python3 -m pylint --rcfile=pylintrc-bug bug.py

Pylint output

************* Module bug
bug.py:12:0: W9015: "_iterable" missing in parameter documentation (missing-param-doc)

------------------------------------------------------------------
Your code has been rated at 8.89/10 (previous run: 8.89/10, +0.00)

Expected behavior

Since _iterable is clearly documented in the google style, there should be no missing-param-doc error.

Pylint version

pylint 3.2.3
astroid 3.2.2
Python 3.8.16 (default, Mar 24 2023, 14:42:29)
[Clang 14.0.0 (clang-1400.0.29.202)]

OS / Environment

macOS 14

Additional dependencies

No response

Attachments

This zip contains bug.py and pylintrc-bug.

@finite-state-machine finite-state-machine added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 20, 2024
@mbyrnepr2 mbyrnepr2 added Needs PR This issue is accepted, sufficiently specified and now needs an implementation False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 20, 2024
mbyrnepr2 added a commit to mbyrnepr2/pylint that referenced this issue Jun 20, 2024
… decorated with ``typing.overload`` is missing a doc param in its docstring.

Closes pylint-dev#9739
mbyrnepr2 added a commit to mbyrnepr2/pylint that referenced this issue Jun 20, 2024
…s decorated with ``typing.overload`` was expected to have a docstring specifying its parameters.

Closes pylint-dev#9739
mbyrnepr2 added a commit to mbyrnepr2/pylint that referenced this issue Jun 20, 2024
…s decorated with ``typing.overload`` was expected to have a docstring specifying its parameters.

Closes pylint-dev#9739
@finite-state-machine
Copy link
Author

@mbyrnepr2 Thanks for the very quick fix!

@jacobtylerwalls jacobtylerwalls added this to the 3.2.6 milestone Jul 14, 2024
jacobtylerwalls pushed a commit that referenced this issue Jul 15, 2024
* Fix a false positive for ``missing-param-doc`` where a method which is decorated with ``typing.overload`` was expected to have a docstring specifying its parameters.

Closes #9739
github-actions bot pushed a commit that referenced this issue Jul 15, 2024
* Fix a false positive for ``missing-param-doc`` where a method which is decorated with ``typing.overload`` was expected to have a docstring specifying its parameters.

Closes #9739

(cherry picked from commit 9cd5c37)
jacobtylerwalls pushed a commit that referenced this issue Jul 15, 2024
* Fix a false positive for ``missing-param-doc`` where a method which is decorated with ``typing.overload`` was expected to have a docstring specifying its parameters.

Closes #9739

(cherry picked from commit 9cd5c37)

Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants