Skip to content

PIE790 fix can make non-docstrings into docstrings #12616

@dscorbett

Description

@dscorbett

There is one case where the fix for PIE790 is not completely safe: it changes behavior when the placeholder statement is blocking a string from being a docstring.

$ ruff --version
ruff 0.5.5
$ cat pie790.py
pass
"docstring?"
print(f"{__doc__=}")
$ python pie790.py
__doc__=None
$ ruff check --isolated --fix --select PIE790 pie790.py
Found 1 error (1 fixed, 0 remaining).
$ python pie790.py
__doc__='docstring?'

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixesRelated to suggested fixes for violationshelp wantedContributions especially welcomeruleImplementing or modifying a lint rule

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions