Skip to content

False positive for RST213 and RST210 from *arg and **kwargs #18

@sobolevn

Description

@sobolevn

This code produces two violations:

def include(*args: str, **kwargs) -> None:
    """
    Used for including Django project settings from multiple files.

    Args:
        *args: File paths (``glob`` - compatible wildcards can be used).
        **kwargs: Settings context: ``scope=globals()`` or ``None``.

    """

Output:

» flake8 .

./split_settings/tools.py

  65:1     RST299 Inline emphasis start-string without end-string.
  Args:
  ^

  65:1     RST210 Inline strong start-string without end-string.
  Args:
  ^

That's because flake8-rst-docstrings is unhappy about *args and **kwargs in the docs. But, napoleon and google explicitly says to write them like so, proof: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html#example-google

def module_level_function(param1, param2=None, *args, **kwargs):
    """This is an example of a module level function.

    ...

    Args:
        param1 (int): The first parameter.
        param2 (:obj:`str`, optional): The second parameter. Defaults to None.
            Second line of description should be indented.
        *args: Variable length argument list.
        **kwargs: Arbitrary keyword arguments.
    
    ...
    """

So, I guess that these two rules should respect this case.

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