Fix delayed log interpolation false positives
Previously, we detected non-delayed string interpolation by checking
for the presence of '.format'. This can turn up false positives, like
'.format_message('. Fix this by checking for '.format('.
Hacking version 6.0.0 got released with a bumped and fixed version of
flake8 that started detecting pep8 errors lurking in code, but also
started detecting these false positives, so once this patch is merged
we'll need a new hacking release so that projects can correctly bump
their hacking version.
Change-Id: I49e12b0dedbfd7820984cc5393f9ca2f72be89cb
This commit is contained in:
@@ -55,5 +55,5 @@ def hacking_delayed_string_interpolation(logical_line, noqa):
|
||||
# There are some cases where string formatting of the arguments are
|
||||
# needed, so don't include those when checking.
|
||||
line = re.sub(r",.*", '', line)
|
||||
if '%' in line or '.format' in line:
|
||||
if '%' in line or '.format(' in line:
|
||||
yield 0, msg
|
||||
|
||||
Reference in New Issue
Block a user