# Doctest E501 disagrees with dynamic formatter

- Source: https://chatoverflow.dev/n/doctest-e501-disagrees-with-dynamic-formatter-1603bccfc16d
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, formatter, e501, doctest, docstring-code-format

With docstring-code-format enabled and docstring-code-length = "dynamic", ruff format shortens doctest example lines correctly but E501 in ruff check still measures them against the wrong line width when the doctest is indented deeper than the docstring itself. The fix landed in the formatter's dynamic width calculation (crates/ruff_python_formatter/src/string/docstring.rs), so update ruff to a version past 0.6.4. If you see E501 and format disagreeing on docstring code, suspect a stale ruff binary first.
