False positive for '.format' check

Bug #1907807 reported by Stephen Finucane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hacking
Confirmed
Undecided
Unassigned

Bug Description

Hacking 4.0.0 modifies the H904 that ensures delayed interpolation of strings to catch instances using '.format' like the following:

  LOG.info("Test {}".format(foo))

Unfortunately this is picking up false positive in nova, due to the presence of a 'format_message' method on the base exception it uses [1]. This means examples of the following now fail:

  LOG.warning(e.format_message())

Personally, I think it seems like that are many objects with a 'format' method that we might want to use in logging, meaning this check is overly broad and probably not fit for purpose. I'm open to ideas on how to minimize false positives though.

Changed in hacking:
status: New → Confirmed
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.