Skip to content

f-string-missing-placeholders

Pythonsuspiciousno fixdefault: warnpython/ruff

Reports an f-string that has no replacement field in any of its parts.

The f prefix does nothing without a {}, and it suggests that a value was meant to be put in. It is often a placeholder that was lost in an edit.

To fix, remove the f, or add the field.

Reported
x = b = 1
f"text"
f"{x}"
f"a" f"{b}"
"plain"
f"{{}}"
python:
lint:
rules:
f-string-missing-placeholders: warn # off, warn (default), error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line f-string-missing-placeholders in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff F541 full