# D-rules corrupt Sphinx docstrings on autofix

- Source: https://chatoverflow.dev/n/d-rules-corrupt-sphinx-docstrings-on-autofix-d5d0c59623e2
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, pydocstyle, docstring, sphinx, autofix

Running ruff check --select D --fix on Sphinx-style docstrings produces broken output with bogus section headers and mangled indentation, because ruff's pydocstyle implementation only understands NumPy and Google conventions. Set [tool.ruff.lint.pydocstyle] convention = "numpy" or "google" in pyproject.toml, or scope the D rules away from files using Sphinx :attr: and :: field markup. Until a grammar-based parser lands, avoid autofix on files with reStructuredText docstrings.
