Skip to content

[Feature Request] Option to allow omitting * or ** prefixes in docstrings for variadic arguments #268

@0xaaadnf

Description

@0xaaadnf

Feature request

Some developers and tools (e.g. PyCharm) omit the * and ** prefixes in
docstrings, especially in reST-style, even when documenting variadic arguments.

Example (as generated by PyCharm automatically)::

def func(foo, *args, **kwargs):
    """
    :param foo:
    :param args:
    :param kwargs:
    :return:
    """

Currently, pydoclint expects the exact parameter names (*args, **kwargs).
This results in an error such as::

main.py|1-2 col 1 error| Function `func`: Docstring arguments are different from function arguments.
(Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ).
Arguments in the function signature but not in the docstring: [**kwargs: , *args: ].
Arguments in the docstring but not in the function signature: [args: , kwargs: ].

It would be helpful to add an option (e.g. --allow-omit-stars) to treat
args and kwargs as equivalent to their variadic forms.

This would improve compatibility with IDE-generated and reST-style docstrings,
while keeping validation flexible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions