diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2018-12-14 15:42:17 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2018-12-14 15:43:52 +0000 |
commit | 57281199b857afad232d52423e35c9d501e44b5f (patch) | |
tree | 78ef79cb3d9eee4c7326f857d244384721219ef2 /test/lint/lint-format-strings.py | |
parent | 7a30e0f6c54443616fdc28b7080dcbc9b630ac77 (diff) |
lint/format-strings: Correctly exclude escaped percent symbols
Diffstat (limited to 'test/lint/lint-format-strings.py')
-rwxr-xr-x | test/lint/lint-format-strings.py | 5 |
1 files 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": |