Skip to content

percent-format-star-requires-sequence

Pythoncorrectnessno fixdefault: warnpython/ruff

Reports a % format with a * width or precision applied to a dict.

A * takes its number from a tuple of values. Python raises TypeError: * wants int.

To fix, pass a tuple with the width before the value, or write the number in the format.

Reported
...
"%*s" % {"x": 1}
"%s" % a
"%s %s" % (*a,)
"%(x)s" % {"x": 1, **a}
...
python:
lint:
rules:
percent-format-star-requires-sequence: warn # off, warn (default), error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line percent-format-star-requires-sequence 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 F508 full