Commit 9f220fe0 authored by Michal Čihař's avatar Michal Čihař

Do not misdetect %% as position based format string

parent 59179008
......@@ -196,7 +196,7 @@ class PythonFormatCheck(BaseFormatCheck):
regexp = PYTHON_PRINTF_MATCH
def is_position_based(self, string):
return '(' not in string
return '(' not in string and string != '%'
class PHPFormatCheck(BaseFormatCheck):
......@@ -210,7 +210,7 @@ class PHPFormatCheck(BaseFormatCheck):
regexp = PHP_PRINTF_MATCH
def is_position_based(self, string):
return '$' not in string
return '$' not in string and string != '%'
class CFormatCheck(BaseFormatCheck):
......
......@@ -132,6 +132,15 @@ class PythonFormatCheckTest(TestCase):
False
))
def test_reordered_named_format_long(self):
self.assertFalse(self.check.check_format(
u'%(count)d strings into %(languages)d languages %(percent)d%%',
u'%(languages)d dil içinde %(count)d satır %%%(percent)d',
MockUnit('python_reordered_named_format_long'),
0,
False
))
class PHPFormatCheckTest(TestCase):
def setUp(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment