percent-format-expected-sequence
What it does
Section titled “What it does”Reports a % format that has several positional placeholders applied to a dict.
Why it matters
Section titled “Why it matters”Positional placeholders take one value each from a tuple. A dict is taken as one value, so with two or more placeholders Python raises TypeError: not enough arguments for format string.
To fix, pass a tuple, or name the placeholders (%(a)s).
Example
Section titled “Example”..."%s %s" % {"x": 1}..."%*s" % {"x": 1}"%s" % a"%s %s" % (*a,)"%(x)s" % {"x": 1, **a}...Configuration
Section titled “Configuration”python: lint: rules: percent-format-expected-sequence: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line percent-format-expected-sequence in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | F503 |
full |