Skip to content

Implement pydoclint #12434

@augustelalande

Description

@augustelalande

This issue tracks the implementation of pydoclint. Following discussion in #11471 it was decided to prefer pydoclint over darglint for implementation in ruff, since they cover mostly the same ruleset, and pydoclint is still actively developed (unlike darglint). This issue should then supersede #458.

Rules

  • DOC101 Docstring contains fewer arguments than in function signature
  • DOC102 Docstring contains more arguments than in function signature
  • DOC103 Docstring arguments are different from function arguments
  • DOC104 Arguments are the same in the docstring and the function signature, but are in a different order
  • DOC105 Argument names match, but type hints do not match
  • DOC106 The option --arg-type-hints-in-signature is True but there are no argument type hints in the signature (covered by ANN)
  • DOC107 The option --arg-type-hints-in-signature is True but not all args in the signature have type hints (covered by ANN)
  • DOC108 The option --arg-type-hints-in-signature is False but there are argument type hints in the signature (covered by ANN)
  • DOC109 The option --arg-type-hints-in-docstring is True but there are no type hints in the docstring arg list
  • DOC110 The option --arg-type-hints-in-docstring is True but not all args in the docstring arg list have type hints
  • DOC111 The option --arg-type-hints-in-docstring is False but there are type hints in the docstring arg list
  • DOC201 Function/method does not have a return section in docstring
  • DOC202 Function/method has a return section in docstring, but there are no return statements or annotations
  • DOC203 Return type(s) in the docstring not consistent with the return annotation
  • DOC301 __init__() should not have a docstring; please combine it with the docstring of the class
  • DOC302 The class docstring does not need a "Returns" section, because __init__() cannot return anything
  • DOC303 The __init__() docstring does not need a "Returns" section, because it cannot return anything
  • DOC304 Class docstring has an argument/parameter section; please put it in the __init__() docstring
  • DOC305 Class docstring has a "Raises" section; please put it in the __init__() docstring
  • DOC306 The class docstring does not need a "Yields" section, because __init__() cannot yield anything
  • DOC307 The __init__() docstring does not need a "Yields" section, because __init__() cannot yield anything
  • DOC401 (Deprecated; this violation code no longer appears)
  • DOC402 Function/method has "yield" statements, but the docstring does not have a "Yields" section
  • DOC403 Function/method has a "Yields" section in the docstring, but there are no "yield" statements, or the return annotation is not a Generator/Iterator/Iterable
  • DOC404 The types in the docstring's Yields section and the return annotation in the signature are not consistent
  • DOC501 Function/method has "raise" statements, but the docstring does not have a "Raises" section
  • DOC502 Function/method has a "Raises" section in the docstring, but there are not "raise" statements in the body
  • DOC601 Class docstring contains fewer class attributes than actual class attributes
  • DOC602 Class docstring contains more class attributes than in actual class attributes
  • DOC603 Class docstring attributes are different from actual class attributes
  • DOC604 Attributes are the same in docstring and class def, but are in a different order
  • DOC605 Attribute names match, but type hints in these attributes do not match

Style support

  • Support google style docstrings.
  • Support numpy style docstrings.
  • Support sphinx style docstrings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docstringRelated to docstring linting or formattingpluginImplementing a known but unsupported plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions