Skip to content

string-dot-format-extra-positional-arguments

Pythoncorrectnessno fixdefault: warnpython/ruff

Reports a .format call with positional arguments that no field uses.

Python ignores the extra arguments without an error. It is usually a field that was removed from the string, or one that was never added.

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

Reported
...
"{}".format(a, b)
...
"{:{}}".format(a, b)
...
python:
lint:
rules:
string-dot-format-extra-positional-arguments: warn # off, warn (default), error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line string-dot-format-extra-positional-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 F523 full