percent-format-mixed-positional-and-named
What it does
Section titled “What it does”Reports a % format that has both positional placeholders (%s) and named ones (%(a)s).
Why it matters
Section titled “Why it matters”A format takes its values from a tuple or from a mapping, not both. Python raises a TypeError at run time.
To fix, use only named placeholders with a dict, or only positional ones with a tuple.
Example
Section titled “Example”a = b = c = 1..."%s %(x)s" % a...Configuration
Section titled “Configuration”python: lint: rules: percent-format-mixed-positional-and-named: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line percent-format-mixed-positional-and-named 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 | F506 |
full |