Open vepain opened 2 years ago
+1 having the same issue.
Just to add - the following does not raise any error, so maybe just allow items in parenthesis and/or the "default" word after the comma?
def func(x: int = 0):
"""This is func.
Parameter
---------
x : int, optional
The x parameter, by default 0
"""
# ...
I am seeing this as well with
python 3.8.10
pylint 2.14.5
using
pylint.extensions.docparams
@DanielNoord Has this not been fixed yet?
No, I don't think so. The linked PR fixed something different.
@DanielNoord Can you point me to the section of code to review? I can submit a PR if you like.
@DanielNoord Can you point me to the section of code to review? I can submit a PR if you like.
Actually, I'm assuming this is pylint/extensions/docparams.py. I'll submit a PR.
That's right @adam-grant-hendry, most tests for this checker are in https://github.com/PyCQA/pylint/tree/main/tests/functional/ext/docparams
@lkev @vepain One note: you are using Parameter
instead of Parameters
(plural). Change this to Parameters
. pylint
checks for this docstring section using the plural form of the word, so if you don't write it like that, the docparams
extension won't see any of your parameters:
re_param_section = re.compile(
_re_section_template.format(r"(?:Args|Arguments|Parameters)"),
re.X | re.S | re.M,
)
and this is how it is written in the numpydoc
Style Guide.
Note, this doesn't fix the bug, but wanted to point it out because you will silently think everything is fine when it is not.
Bug description
False negative : Warning "missing param doc" should'nt be raised when these type of docstring format:
Configuration
Command used
Pylint output
Expected behavior
No warning
In fact, numpy style doc says:
Pylint version
OS / Environment
Ubuntu 20.04
Additional dependencies
No response