String formatting warning on things that aren't string formatting

Bug #1165416 reported by Jonathan Jacobs
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
twistedchecker
In Progress
Undecided
Unassigned

Bug Description

Code such as "5 % 2" produces the warning: "String formatting operations should always use a tuplefor non-mapping values."

Obviously this isn't a string. (Also "tuplefor" seems to be a typo in the message.)

Related branches

HawkOwl (hawkowl)
Changed in twistedchecker:
status: New → Confirmed
Revision history for this message
HawkOwl (hawkowl) wrote :

Okay so, I've done some investigating here.

I'm about to submit a branch that will fix this, maybe a little bit naively. It parses the left side (in that example, 5) and sees if it can parse it as an int or a float. If it can, it deems it a modulo operation. If the left side is a variable, then without actually knowing what that variable is at run time, it might still be a warning - in which case, people can just ignore it.

HawkOwl (hawkowl)
Changed in twistedchecker:
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.