ruff
ruff copied to clipboard
D301 breaks Click docstrings that use the \b escape sequence
Click uses \b to prevent re-wrapping: https://click.palletsprojects.com/en/8.1.x/documentation/#preventing-rewrapping
Maybe this rule could detect if it's a function docstring that has a @click.* decorator on it, or have a setting that whitelists certain escape sequences.
click docs reference:
\b:
https://click.palletsprojects.com/en/8.1.x/documentation/#preventing-rewrapping Rewrapping can be disabled on a per-paragraph basis by adding a line with solely the
\bescape marker in it.
\f:
https://click.palletsprojects.com/en/8.1.x/documentation/#truncating-help-texts You can use the
\fescape marker to have Click truncate the help text after the marker.
There's ignore-decorators but that requires the fully qualified name and won't work with globs. For now you could try the following config which, as per my limited knowledge of click, should be enough:
[tool.ruff.lint.pydocstyle]
ignore-decorators = [
"click.group",
"click.command",
"click.argument",
"click.option",
]
Playground: https://play.ruff.rs/2a18cbd2-c90a-4416-b19c-f969e688777b
@dhruvmanila
But this ignores docstrings completely.
Specific # noqa: D301 is better.