Skip to content

SIM108 autofix changes quote style of nested f-string #9660

@Gjgarr

Description

@Gjgarr

Description

SIM108 auto-fix changes quote style of nested f-string unnecessarily.

Versions

Python version: 3.12
Ruff version: v0.1.14

Reproduce

Playground link: https://play.ruff.rs/1519e519-94fc-412f-abbb-c8c838a698e7

Given the following:

if 1:
    a = f"# {"".join([])}"
else: 
    a = ""

SIM108 autofix converts this to:

a = f"# {''.join([])}" if 1 else ""

Expected:

a = f"# {"".join([])}" if 1 else ""

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions