changeset 15296:4b71c17caeb8 stable

check-code: report suspicious string joins This detects patterns of the form: ui.write("this is missing" "a space at the join\n")
author Matt Mackall <mpm@selenic.com>
date Mon, 17 Oct 2011 17:27:33 -0500
parents bd9405551ad4
children 3ef434028416 718e0684c703
files contrib/check-code.py
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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"),