Skip to content

Commit

Permalink
lint/format-strings: Correctly exclude escaped percent symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Dec 14, 2018
1 parent 7a30e0f commit 5728119
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/lint/lint-format-strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit 5728119

Please sign in to comment.