Skip to content

percent-format-invalid-format

Pythoncorrectnessno fixdefault: warnpython/ruff

Reports a "..." % x whose format string does not parse, such as a % at the end of the string.

Python raises ValueError: incomplete format when the line runs, so the failure is at run time and only on the path that reaches the line.

To fix, escape a literal percent sign as %%, or complete the conversion.

Reported
a = b = c = 1
"%" % a
...
python:
lint:
rules:
percent-format-invalid-format: warn # off, warn (default), error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line percent-format-invalid-format 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 F501 full