-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Summary
Like #24031.
Incorrect number of format specifies should give error.
There are already many good warnings and tips about using f-strings. Howerever I believe this code does not give any warning about number of arguments:
"" % bananaSince there is 0 placeholders in the string, there should be no reason to use % at all.
Cases to solve for(?) :
"hello" % x # string literal
f"world" % y # f-string? (maybe not because f-string interpolation could produce placeholders)
"hello " * 3 % z # can this be solved for free?
Any more cases that are possible to solve? Easily?
Notes: x could be a tuple with 0 elements, but I can't see any meaningful value in code like that. But does that fact mean this should be it's own lint rule separate from F507?
Related:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule