check-code: report suspicious string joins stable
authorMatt Mackall <mpm@selenic.com>
Mon, 17 Oct 2011 17:27:33 -0500
branchstable
changeset 15296 4b71c17caeb8
parent 15295 bd9405551ad4
child 15297 3ef434028416
child 15307 718e0684c703
check-code: report suspicious string joins This detects patterns of the form: ui.write("this is missing" "a space at the join\n")
contrib/check-code.py
--- a/contrib/check-code.py	Mon Oct 17 19:10:28 2011 -0200
+++ b/contrib/check-code.py	Mon Oct 17 17:27:33 2011 -0500
@@ -126,6 +126,7 @@
     (r'(?m)(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
      r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'),
     (r'.{85}', "line too long"),
+    (r'(?m) x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
     (r'[^\n]\Z', "no trailing newline"),
     (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
 #    (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),