diff contrib/check-code.py @ 20868:5db105f216c3 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 the format string and "%" aren't placed in the same line. This patch replaces "\s" in that regexp pattern with "[ \t\n]" to detect "% inside _()" problems in such case. "[\s\n]" can't be used in this purpose, because "\s" is automatically replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes nested "[]" unexpectedly.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 01 Apr 2014 02:46:03 +0900
parents cc09cfea3dd4
children 9658a79968c6
line wrap: on
line diff
--- a/contrib/check-code.py	Tue Apr 01 02:46:03 2014 +0900
+++ b/contrib/check-code.py	Tue Apr 01 02:46:03 2014 +0900
@@ -198,8 +198,8 @@
     (r'\s<>\s', '<> operator is not available in Python 3+, use !='),
     (r'^\s*\t', "don't use tabs"),
     (r'\S;\s*\n', "semicolon"),
-    (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"),
-    (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"),
+    (r'[^_]_\("[^"]+"[ \t\n]*%', "don't use % inside _()"),
+    (r"[^_]_\('[^']+'[ \t\n]*%", "don't use % inside _()"),
     (r'(\w|\)),\w', "missing whitespace after ,"),
     (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
     (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),