escape-sequence-in-docstring (D301) reports escaped docstrings within docstrings #12152
Labels
bug
Something isn't working
docstring
Related to docstring linting or formatting
help wanted
Contributions especially welcome
rule
Implementing or modifying a lint rule
Running
on
returns an escape-sequence-in-docstring (D301) diagnostic, printing
However, adding the
r
prefix and removing the backslashes is a syntax error:Docstrings in within docstrings can appear when a docstring contains a code snippet (which is how I discovered the issue). I would expect D301 not to be raised, as making the docstring raw doesn't work.
Ruff version 0.5.0
Search terms: D301, backslash, escape
Update: managed to reproduce with
as well.
The text was updated successfully, but these errors were encountered: