string-dot-format-invalid-format
What it does
Section titled “What it does”Reports a "...".format(...) call whose string does not parse, such as an unmatched { or }.
Why it matters
Section titled “Why it matters”Python raises a ValueError (Single '{' encountered in format string) when the line runs. It is usually a literal brace that should have been doubled.
To fix, write {{ and }} for literal braces.
Example
Section titled “Example”a = b = c = 1"{".format(a)..."{:{}}".format(a, b)"{:{:{}}}".format(a, b, c)"{} {x}".format(*a, **b)"{}".format(a, *b)"{0[a].b}".format(a)"{!}".format(a)"{0[}".format(a)Configuration
Section titled “Configuration”python: lint: rules: string-dot-format-invalid-format: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line string-dot-format-invalid-format 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 | F521 |
full |