An f-string has no replacement fields
What it finds
f"done": an f-string without replacement fields is a plain string with a prefix that promises more, often left over from an edit or written where a field was forgotten. Implicitly concatenated parts count together, so f"{a} " f"and b" is fine.
The fix removes the f and turns doubled braces into single ones, which gives the same string.
From the rule's source, fstring_without_placeholders.rs.
def report(name, log): log(f"done")tx0 reports: this f-string has no replacement fields log(F'{{braces}}')tx0 reports: this f-string has no replacement fields log(f"part one " f"part two")tx0 reports: this f-string has no replacement fields log(f"{name} " f"and more") log(f"{name!r:>10}") log("plain") log(t"template") Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:fstring-without-placeholders" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:fstring-without-placeholders] reason="..."tx0 explain tx0/python:fstring-without-placeholders shows the same in the terminal. Found a false positive? Report it.