percent-format-positional-count-mismatch
What it does
Section titled “What it does”Reports a % format whose number of placeholders differs from the number of values in the tuple.
Why it matters
Section titled “Why it matters”Python raises a TypeError when the line runs: not enough arguments for format string with too few values, not all arguments converted during string formatting with too many.
To fix, make the two counts the same.
Example
Section titled “Example”..."%s %s" % {"x": 1}..."%s %s" % (a,)"%*s" % {"x": 1}"%s" % a"%s %s" % (*a,)"%(x)s" % {"x": 1, **a}...Configuration
Section titled “Configuration”python: lint: rules: percent-format-positional-count-mismatch: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line percent-format-positional-count-mismatch 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 | F507 |
full |