Table of Contents
You can suppress DOC violations inline with the same # noqa: syntax that
flake8 and Ruff understand. When running the native CLI, set where those
comments live with --native-mode-noqa-location (docstring by default, also
accepts definition):
docstring: put the # noqa: comment after the closing triple quotes of the
docstring.definition: put the comment on the line that defines the function/class.def funcDocstringComment(arg1: int, arg2: int) -> None:
"""Docstring text.
""" # noqa: DOC101, DOC103
def funcDefinitionComment(arg1: int, arg2: int) -> None: # noqa: DOC103
"""Docstring text."""
Multiple DOC codes can be listed, and partial prefixes work as well. For
example, # noqa: DOC1 suppresses every violation whose code starts with
DOC1 (e.g., DOC101, DOC103).
In flake8 mode (meaning that you use pydoclint as a flake8 plugin), if
you’d like to ignore a specific violation code (such as DOC201 and DOC301)
in-line, you can add this comment to the function of your choice:
def my_function( # noqa: DOC201, DOC301
arg1,
arg2,
) -> None:
...
If you would like to ignore certain categories of violations (such as DOC2xx)
in-line, you can do this:
def my_function( # noqa: DOC2
arg1,
arg2,
) -> None:
...
All the usage is consistent with how you would use flake8. Please read the official flake8 documentation for full details: https://flake8.pycqa.org/en/latest/user/violations.html.
With ruff>=0.1.3, allowlist DOC codes using the
external setting:
Put the following in your pyproject.toml file:
[tool.ruff]
external = [
"DOC", # pydoclint
]