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

Ignore special argument names on Parameter Documentation checker #3800

Closed
luigibertaco opened this issue Aug 27, 2020 · 1 comment · Fixed by #3842
Closed

Ignore special argument names on Parameter Documentation checker #3800

luigibertaco opened this issue Aug 27, 2020 · 1 comment · Fixed by #3842
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors

Comments

@luigibertaco
Copy link
Contributor

luigibertaco commented Aug 27, 2020

Is your feature request related to a problem? Please describe

Yes. Pylint handles special variables names (_, __, ignored_, etc) very well in most cases. However, it doesn't have the same behaviour for Parameter Documentation checker.

This code:

def function_foo(name, _):
    """function foo ...

    Parameters
    ----------
    name: str
        description
    """
    print(name)

Will complain about not documenting the parameter "_"

************* Module pylint_config
pylint_config.py:1:0: W9015: "_" missing in parameter documentation (missing-param-doc)
pylint_config.py:1:0: W9016: "_" missing in parameter type documentation (missing-type-doc)

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

Describe the solution you'd like

It would be helpful if the ignored argument names were also ignored on docstrings.

Alternatively, a way for disabling the check for ignored arguments would also work.

Or even a regex config to be used on .pylintrc like:

missing-param-doc=^(_) # ignore docs for parameters starting with _
@AWhetter AWhetter added Good first issue Friendly and approachable by new contributors Enhancement ✨ Improvement to a component labels Sep 7, 2020
@AWhetter
Copy link
Contributor

AWhetter commented Sep 7, 2020

To any new contributors looking to implement this issue, the pylint.extensions.docparams extension is responsible for raising this warning. We can use pylint.utils.get_global_option() to get the value of the ignored-argument-names option. Then DocstringParameterChecker.check_arguments_in_docstring() can use the value of the option to add any matching arguments to the ignore lists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants