Skip to content

FLY002 fix causes syntax error with double quotes in the strings #19837

@MeGaGiGaGon

Description

@MeGaGiGaGon

Summary

When the joined items contain both a variable and a string with a double quote, the fix for static-join-to-f-string (FLY002) will cause a syntax error playground:

PS ~>echo @'
"".join((foo, '"'))
'@ | uvx ruff check --select FLY002 - --fix --unsafe-fixes 2>&1 | rg "syntax error"
error: Fix introduced a syntax error. Reverting all changes.

Version

ruff 0.12.8 (f51a228 2025-08-07)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixesRelated to suggested fixes for violations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions