Skip to main content

Remove Unnecessary F-strings

pixee:python/remove-unnecessary-f-str

ImportanceReview GuidanceRequires Scanning Tool
LowMerge Without ReviewNo

This codemod converts any f-strings without interpolated variables into regular strings. In these cases the use of f-string is not necessary; a simple string literal is sufficient.

While in some (extreme) cases we might expect a very modest performance improvement, in general this is a fix that improves the overall cleanliness and quality of your code.

- var = f"hello"
+ var = "hello"
...

If you have feedback on this codemod, please let us know!

F.A.Q.

Why is this codemod marked as Merge Without Review?

We believe this codemod is safe and will not cause any issues.

Codemod Settings

N/A

References