Skip to content

string-dot-format-missing-arguments

Pythoncorrectnessno fixdefault: warnpython/ruff

Reports a .format call without an argument for a field of its string.

Python raises an IndexError for a positional field or a KeyError for a named one when the line runs.

To fix, pass the argument, or correct the field.

Reported
a = b = c = 1
...
"{} {}".format(a)
...
"{x}".format(y=1)
...
"{:{}}".format(a, b)
...
python:
lint:
rules:
string-dot-format-missing-arguments: warn # off, warn (default), error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line string-dot-format-missing-arguments 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 F524 full