Skip to content

string-dot-format-mixing-automatic

Pythoncorrectnessno fixdefault: warnpython/ruff

Reports a .format string that has both automatic fields ({}) and numbered ones ({0}).

Python raises ValueError: cannot switch from automatic field numbering to manual field specification when the line runs.

To fix, use one kind of field in a string.

Reported
a = b = c = 1
...
"{} {0}".format(a)
...
python:
lint:
rules:
string-dot-format-mixing-automatic: warn # off, warn (default), error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line string-dot-format-mixing-automatic 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 F525 full