Skip to content

percent-format-missing-argument

Pythoncorrectnessno fixdefault: warnpython/ruff

Reports a % format with named placeholders that the dict does not have.

Python raises a KeyError for the first missing key when the line runs. A key that is misspelled in the string or in the dict is the usual cause.

To fix, add the key, or correct the name.

Reported
...
"%(x)s %(y)s" % {"x": 1}
...
"%s" % a
...
python:
lint:
rules:
percent-format-missing-argument: warn # off, warn (default), error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line percent-format-missing-argument 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 F505 full