Skip to content

string-dot-format-extra-named-arguments

Pythoncorrectnessno fixdefault: warnpython/ruff

Reports a .format call with keyword arguments that no field names.

Python ignores the extra keywords without an error, so a leftover after an edit, or a field that was misspelled, goes unnoticed.

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

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

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line string-dot-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 F522 full