lint/format-strings: Correctly exclude escaped percent symbols

This commit is contained in:
Luke Dashjr 2018-12-14 15:42:17 +00:00
parent 7a30e0f6c5
commit 57281199b8

View file

@ -241,12 +241,11 @@ def count_format_specifiers(format_string):
4
"""
assert(type(format_string) is str)
format_string = format_string.replace('%%', 'X')
n = 0
in_specifier = False
for i, char in enumerate(format_string):
if format_string[i - 1:i + 1] == "%%" or format_string[i:i + 2] == "%%":
pass
elif char == "%":
if char == "%":
in_specifier = True
n += 1
elif char in "aAcdeEfFgGinopsuxX":