Skip to content

percent-format-extra-named-arguments

Pythoncorrectnessno fixdefault: warnpython/ruff

Reports a % format applied to a dict that has keys that no placeholder names.

Python ignores the extra keys without an error. The key is a leftover after the format string was edited, or a placeholder was misspelled and the value is never shown.

To fix, remove the key, or add the placeholder.

Reported
...
"%(x)s" % {"x": 1, "y": 2}
...
python:
lint:
rules:
percent-format-extra-named-arguments: warn # off, warn (default), error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line percent-format-extra-named-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 F504 full