comparison contrib/check-code.py @ 20869:9658a79968c6 stable

i18n: fix "% inside _()" problems Before this patch, "contrib/check-code.py" can't detect these problems, because the regexp pattern to detect "% inside _()" doesn't suppose the case that format string consists of multiple string components concatenated implicitly or explicitly, This patch does below for that regexp pattern to detect "% inside _()" problems in such case. - put "+" into separator part ("[ \t\n]") for explicit concatenation ("...." + "...." style) - enclose "component and separator" part by "(?:....)+" for concatenation itself ("...." "...." or "...." + "....")
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 01 Apr 2014 02:46:03 +0900
parents 5db105f216c3
children 6500a2eebee8
comparison
equal deleted inserted replaced
20868:5db105f216c3 20869:9658a79968c6
196 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"), 196 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
197 (r'\.has_key\b', "dict.has_key is not available in Python 3+"), 197 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
198 (r'\s<>\s', '<> operator is not available in Python 3+, use !='), 198 (r'\s<>\s', '<> operator is not available in Python 3+, use !='),
199 (r'^\s*\t', "don't use tabs"), 199 (r'^\s*\t', "don't use tabs"),
200 (r'\S;\s*\n', "semicolon"), 200 (r'\S;\s*\n', "semicolon"),
201 (r'[^_]_\("[^"]+"[ \t\n]*%', "don't use % inside _()"), 201 (r'[^_]_\((?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"),
202 (r"[^_]_\('[^']+'[ \t\n]*%", "don't use % inside _()"), 202 (r"[^_]_\((?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"),
203 (r'(\w|\)),\w', "missing whitespace after ,"), 203 (r'(\w|\)),\w', "missing whitespace after ,"),
204 (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"), 204 (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
205 (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), 205 (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),
206 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' 206 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
207 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'), 207 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'),