terrencepreilly / darglint

A python documentation linter which checks that the docstring description matches the definition.
MIT License
481 stars 41 forks source link

DAR101: Ignore *args and **kwargs arguments marked as unused #187

Open KRunchPL opened 2 years ago

KRunchPL commented 2 years ago

Summary

Varargs arguments prefixed with an underscore (*_remaining_args) are required in the docstring. I am not an expert in Python style, but I feel they should not be required, especially that names _something are not causing DAR101.

Reproduction

  1. Create a demo.py file with the following content

    def foo(visible_arg, _hidden_arg, *_remaining_args, **_remaining_kwargs):
    """
    Noop
    
    :param visible_arg: some value
    """
  2. Execute darglint -s sphinx demo.py

Expected result

No DAR101 errors reported by darglint (all non-hidden args are defined in the docstring).

Actual result

Two DAR101 are shown:

demo.py:foo:4: DAR101: - **_remaining_kwargs
demo.py:foo:4: DAR101: - *_remaining_args 

Versions used

darglint 1.8.1 Python 3.10.0

Additional information

It would be a combination of those two issues: https://github.com/terrencepreilly/darglint/issues/60 https://github.com/terrencepreilly/darglint/issues/92

Gratitude

I would like to use an opportunity to say THANK YOU to the creator of this tool and other contributors.

Also (after reading some issue) I would like to thank the owner of the repo, for the way you are talking to your users (people that are reporting issues etc.). I would hope more owners would treat "their community" the way you do.