diff --git a/hacking/checks/other.py b/hacking/checks/other.py index 77b9cceb..923c7088 100644 --- a/hacking/checks/other.py +++ b/hacking/checks/other.py @@ -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: + if '%' in line or '.format' in line: yield 0, msg diff --git a/hacking/tests/checks/test_other.py b/hacking/tests/checks/test_other.py index 1e6a04e1..a9fab5e8 100644 --- a/hacking/tests/checks/test_other.py +++ b/hacking/tests/checks/test_other.py @@ -25,6 +25,7 @@ class OthersTestCase(tests.TestCase): @ddt.data( (1, 'LOG.debug("Test %s" % foo)', None), (0, 'LOG.info("Test %s", foo)', None), + (1, 'LOG.info("Test {}".format(foo))', None), (0, 'LOG.error("Test %s" % foo)', '# noqa'), (1, 'LOG.debug("Test %s" % "foo")', None), (0, 'LOG.debug("Test %s", "foo")', None),