pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.31k stars 1.13k forks source link

Docparams does not raise `differing-type-doc` for Sphinx documentation #6478

Open saroad2 opened 2 years ago

saroad2 commented 2 years ago

Bug description

When trying to run Pylint on a function with wrong parameter type in docstring, written in Sphinx format, no differing-type-doc (code W9018) is risen when docparams plugin is enabled.

For example, the following code doesn't raise no error:

"""This is module documentation."""

def my_func(some_int: int) -> float:
    """
    Some function.

    :param some_int: This is a parameter
    :type some_int: str
    :return: some float
    :rtype: float
    """
    return some_int + 0.5

Configuration

No configuration

Command used

pylint --load-plugins=pylint.extensions.docparams a.py

Pylint output

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

Expected behavior

differing-type-doc should be raised on parameter some_int, because it is an int variable that was documented as str.

Pylint version

pylint 2.13.7
astroid 2.11.3
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]
Matesanz commented 2 years ago

Same problem in pylint == 2.15.2

Matesanz commented 1 month ago

Same problem in pylint == 3.2.7