The goal of this issue is to get Ruff to lint and format attribute docstrings as already done for class/method/function docstrings.
PEP 224 is about attribute docstrings. It was rejected but its proposed syntax (where a triple quote string can be placed under a class attribute to document it) has become a de facto standard:
The goal of this issue is to get Ruff to lint and format attribute docstrings as already done for class/method/function docstrings.
PEP 224 is about attribute docstrings. It was rejected but its proposed syntax (where a triple quote string can be placed under a class attribute to document it) has become a de facto standard:
:autoattribute: directive
.For example, with this code:
Sphinx outputs the expected HTML:
and
shpinx.ext.doctest
would even detect interactive Python sessions invalue
's docstring and check them.VS Code also shows the attribute docstring on hover:
On the other hand, with this code trying to document the attribute in a Google style docstring:
Sphinx, even with sphinx.ext.napoleon correctly configured, duplicates the attribute:
and VS Code does not show the docstring on hover:
Would you consider detecting this syntax as attribute docstrings and handling them like the other docstrings (e.g. formatting code examples in them)?