From 57281199b857afad232d52423e35c9d501e44b5f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 14 Dec 2018 15:42:17 +0000 Subject: [PATCH] lint/format-strings: Correctly exclude escaped percent symbols --- test/lint/lint-format-strings.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/lint/lint-format-strings.py b/test/lint/lint-format-strings.py index 5caebf3739..f5d4780b6d 100755 --- a/test/lint/lint-format-strings.py +++ b/test/lint/lint-format-strings.py @@ -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":