##// END OF EJS Templates
check-code: detect "% inside _()" when there are leading whitespaces...
FUJIWARA Katsunori -
r21097:e8ef59b3 default
parent child Browse files
Show More
@@ -207,8 +207,8 b' pypats = ['
207 (r'\s<>\s', '<> operator is not available in Python 3+, use !='),
207 (r'\s<>\s', '<> operator is not available in Python 3+, use !='),
208 (r'^\s*\t', "don't use tabs"),
208 (r'^\s*\t', "don't use tabs"),
209 (r'\S;\s*\n', "semicolon"),
209 (r'\S;\s*\n', "semicolon"),
210 (r'[^_]_\((?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"),
210 (r'[^_]_\([ \t\n]*(?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"),
211 (r"[^_]_\((?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"),
211 (r"[^_]_\([ \t\n]*(?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"),
212 (r'(\w|\)),\w', "missing whitespace after ,"),
212 (r'(\w|\)),\w', "missing whitespace after ,"),
213 (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
213 (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
214 (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),
214 (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),
@@ -255,3 +255,32 b''
255 warning: add two newlines after '.. note::'
255 warning: add two newlines after '.. note::'
256 [1]
256 [1]
257
257
258 $ cat > ./map-inside-gettext.py <<EOF
259 > print _("map inside gettext %s" % v)
260 >
261 > print _("concatenating " " by " " space %s" % v)
262 > print _("concatenating " + " by " + " '+' %s" % v)
263 >
264 > print _("maping operation in different line %s"
265 > % v)
266 >
267 > print _(
268 > "leading spaces inside of '(' %s" % v)
269 > EOF
270 $ "$check_code" ./map-inside-gettext.py
271 ./map-inside-gettext.py:1:
272 > print _("map inside gettext %s" % v)
273 don't use % inside _()
274 ./map-inside-gettext.py:3:
275 > print _("concatenating " " by " " space %s" % v)
276 don't use % inside _()
277 ./map-inside-gettext.py:4:
278 > print _("concatenating " + " by " + " '+' %s" % v)
279 don't use % inside _()
280 ./map-inside-gettext.py:6:
281 > print _("maping operation in different line %s"
282 don't use % inside _()
283 ./map-inside-gettext.py:9:
284 > print _(
285 don't use % inside _()
286 [1]
General Comments 0
You need to be logged in to leave comments. Login now