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

missing-param-doc for numpy doc style: variable with list of legal values #4035

Closed
juliangilbey opened this issue Jan 18, 2021 · 2 comments · Fixed by #7149
Closed

missing-param-doc for numpy doc style: variable with list of legal values #4035

juliangilbey opened this issue Jan 18, 2021 · 2 comments · Fixed by #7149
Assignees
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

@juliangilbey
Copy link

According to the NumPy documentation style guidelines, section 4:

When a parameter can only assume one of a fixed set of values, those values can be listed in braces, with the default appearing first:

order : {'C', 'F', 'A'}
    Description of `order`.

However, using this syntax in a function docstring causes pylint to complain about missing-param-doc and missing-type-doc.

Here's a minimal example. (With only one parameter of this form, it is completely ignored.)

def myfunc(arg, option):
    """Do something boring.

    Parameters
    ----------
    arg : int
        The number of times to print it.
    option : {"y", "n"}
        Do I do it?

    """
    for i in range(arg):
        print(option)

and here is the pylint output:

************* Module pylint_test
pylint_test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
pylint_test.py:1:0: W9015: "option" missing in parameter documentation (missing-param-doc)
pylint_test.py:1:0: W9016: "option" missing in parameter type documentation (missing-type-doc)
pylint_test.py:12:8: W0612: Unused variable 'i' (unused-variable)

------------------------------------
Your code has been rated at -3.33/10

pylint --version output

pylint 2.6.0
astroid 2.4.2
Python 3.9.1+ (default, Jan 10 2021, 15:42:50) 
[GCC 10.2.1 20201224]
@hippo91
Copy link
Contributor

hippo91 commented Jan 30, 2021

@juliangilbey thanks for this report.

@hippo91 hippo91 added Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code labels Jan 30, 2021
@DanielNoord DanielNoord self-assigned this Oct 30, 2021
@DanielNoord
Copy link
Collaborator

I would like to fix this after merging #5231

@Pierre-Sassoulas Pierre-Sassoulas added Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Bug 🪲 labels Jul 4, 2022
@DanielNoord DanielNoord added this to the 2.14.5 milestone Jul 8, 2022
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.

4 participants