Mercurial > public > mercurial-scm > hg-stable
comparison contrib/check-code.py @ 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 | ebeac9c41456 |
children | 24856af7237c |
comparison
equal
deleted
inserted
replaced
15295:bd9405551ad4 | 15296:4b71c17caeb8 |
---|---|
124 (r'\w[+/*\-<>]\w', "missing whitespace in expression"), | 124 (r'\w[+/*\-<>]\w', "missing whitespace in expression"), |
125 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"), | 125 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"), |
126 (r'(?m)(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' | 126 (r'(?m)(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' |
127 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'), | 127 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'), |
128 (r'.{85}', "line too long"), | 128 (r'.{85}', "line too long"), |
129 (r'(?m) x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), | |
129 (r'[^\n]\Z', "no trailing newline"), | 130 (r'[^\n]\Z', "no trailing newline"), |
130 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), | 131 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), |
131 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"), | 132 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"), |
132 # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"), | 133 # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"), |
133 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', | 134 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', |