Skip to content

Commit 5728119

Browse files
committed
lint/format-strings: Correctly exclude escaped percent symbols
1 parent 7a30e0f commit 5728119

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

test/lint/lint-format-strings.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,11 @@ def count_format_specifiers(format_string):
241241
4
242242
"""
243243
assert(type(format_string) is str)
244+
format_string = format_string.replace('%%', 'X')
244245
n = 0
245246
in_specifier = False
246247
for i, char in enumerate(format_string):
247-
if format_string[i - 1:i + 1] == "%%" or format_string[i:i + 2] == "%%":
248-
pass
249-
elif char == "%":
248+
if char == "%":
250249
in_specifier = True
251250
n += 1
252251
elif char in "aAcdeEfFgGinopsuxX":

0 commit comments

Comments
 (0)