Mercurial > hg
comparison contrib/check-code.py @ 27640:8d0a09162d0f
check-code: enforce strict spacing around assignment
author | timeless <timeless@mozdev.org> |
---|---|
date | Thu, 31 Dec 2015 17:41:59 +0000 |
parents | 15b06f306c1f |
children | 2b9126d6588b |
comparison
equal
deleted
inserted
replaced
27639:dbd47b21fd28 | 27640:8d0a09162d0f |
---|---|
125 (r'^diff *-\w*[uU].*$\n(^ \$ |^$)', "prefix diff -u/-U with cmp"), | 125 (r'^diff *-\w*[uU].*$\n(^ \$ |^$)', "prefix diff -u/-U with cmp"), |
126 (r'^\s+(if)? diff *-\w*[uU]', "prefix diff -u/-U with cmp"), | 126 (r'^\s+(if)? diff *-\w*[uU]', "prefix diff -u/-U with cmp"), |
127 (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"), | 127 (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"), |
128 (r'\butil\.Abort\b', "directly use error.Abort"), | 128 (r'\butil\.Abort\b', "directly use error.Abort"), |
129 (r'\|&', "don't use |&, use 2>&1"), | 129 (r'\|&', "don't use |&, use 2>&1"), |
130 (r'\w = +\w', "only one space after = allowed"), | |
130 ], | 131 ], |
131 # warnings | 132 # warnings |
132 [ | 133 [ |
133 (r'^function', "don't use 'function', use old style"), | 134 (r'^function', "don't use 'function', use old style"), |
134 (r'^diff.*-\w*N', "don't use 'diff -N'"), | 135 (r'^diff.*-\w*N', "don't use 'diff -N'"), |
218 (r'[^_]_\([ \t\n]*(?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"), | 219 (r'[^_]_\([ \t\n]*(?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"), |
219 (r"[^_]_\([ \t\n]*(?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"), | 220 (r"[^_]_\([ \t\n]*(?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"), |
220 (r'(\w|\)),\w', "missing whitespace after ,"), | 221 (r'(\w|\)),\w', "missing whitespace after ,"), |
221 (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"), | 222 (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"), |
222 (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), | 223 (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), |
224 (r'\w\s=\s\s+\w', "gratuitous whitespace after ="), | |
223 (r'.{81}', "line too long"), | 225 (r'.{81}', "line too long"), |
224 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), | 226 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), |
225 (r'[^\n]\Z', "no trailing newline"), | 227 (r'[^\n]\Z', "no trailing newline"), |
226 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), | 228 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), |
227 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', | 229 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', |
335 (r'\w+\* \w+', "use int *foo, not int* foo"), | 337 (r'\w+\* \w+', "use int *foo, not int* foo"), |
336 (r'\W\([^\)]+\) \w+', "use (int)foo, not (int) foo"), | 338 (r'\W\([^\)]+\) \w+', "use (int)foo, not (int) foo"), |
337 (r'\w+ (\+\+|--)', "use foo++, not foo ++"), | 339 (r'\w+ (\+\+|--)', "use foo++, not foo ++"), |
338 (r'\w,\w', "missing whitespace after ,"), | 340 (r'\w,\w', "missing whitespace after ,"), |
339 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"), | 341 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"), |
342 (r'\w\s=\s\s+\w', "gratuitous whitespace after ="), | |
340 (r'^#\s+\w', "use #foo, not # foo"), | 343 (r'^#\s+\w', "use #foo, not # foo"), |
341 (r'[^\n]\Z', "no trailing newline"), | 344 (r'[^\n]\Z', "no trailing newline"), |
342 (r'^\s*#import\b', "use only #include in standard C code"), | 345 (r'^\s*#import\b', "use only #include in standard C code"), |
343 ], | 346 ], |
344 # warnings | 347 # warnings |