Skip to content

RUF010 diagnostic is unhelpful for an interpolation with debug text #20519

@dscorbett

Description

@dscorbett

Summary

explicit-f-string-type-conversion (RUF010) should be suppressed for interpolations that use = because there is no way to use a conversion flag to get the same output, which the user presumably intended, so the diagnostic is not helpful.

$ cat >ruf010.py <<'# EOF'
print(f"{ascii(1)=}")
# EOF

$ python ruf010.py
ascii(1)='1'

$ ruff --isolated check ruf010.py --select RUF010 --output-format concise -q
ruf010.py:1:10: RUF010 Use explicit conversion flag

Alternatively, if the diagnostic is deemed helpful, I suggest reverting that piece of #18690 and marking the fix unsafe in this case. Either works; it’s just this middle ground of hinting at a change but not showing it that seems unhelpful.

Version

ruff 0.13.1 (706be0a 2025-09-18)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions