Mercurial > public > mercurial-scm > hg
comparison contrib/check-code.py @ 26588:b3f7516fa50e
check-code: detect and ban 'util.Abort'
We have seen the light, please use the new way.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 08 Oct 2015 12:53:09 -0700 |
parents | b80b2ee71a08 |
children | df1a29ec45bf |
comparison
equal
deleted
inserted
replaced
26587:56b2bcea2529 | 26588:b3f7516fa50e |
---|---|
121 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"), | 121 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"), |
122 (r'^( *)\t', "don't use tabs to indent"), | 122 (r'^( *)\t', "don't use tabs to indent"), |
123 (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)', | 123 (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)', |
124 "put a backslash-escaped newline after sed 'i' command"), | 124 "put a backslash-escaped newline after sed 'i' command"), |
125 (r'^diff *-\w*u.*$\n(^ \$ |^$)', "prefix diff -u with cmp"), | 125 (r'^diff *-\w*u.*$\n(^ \$ |^$)', "prefix diff -u with cmp"), |
126 (r'seq ', "don't use 'seq', use $TESTDIR/seq.py") | 126 (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"), |
127 (r'\butil\.Abort\b', "directly use error.Abort"), | |
127 ], | 128 ], |
128 # warnings | 129 # warnings |
129 [ | 130 [ |
130 (r'^function', "don't use 'function', use old style"), | 131 (r'^function', "don't use 'function', use old style"), |
131 (r'^diff.*-\w*N', "don't use 'diff -N'"), | 132 (r'^diff.*-\w*N', "don't use 'diff -N'"), |
291 (r'os\.path\.join\(.*, *(""|\'\')\)', | 292 (r'os\.path\.join\(.*, *(""|\'\')\)', |
292 "use pathutil.normasprefix(path) instead of os.path.join(path, '')"), | 293 "use pathutil.normasprefix(path) instead of os.path.join(path, '')"), |
293 (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'), | 294 (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'), |
294 # XXX only catch mutable arguments on the first line of the definition | 295 # XXX only catch mutable arguments on the first line of the definition |
295 (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"), | 296 (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"), |
297 (r'\butil\.Abort\b', "directly use error.Abort"), | |
296 ], | 298 ], |
297 # warnings | 299 # warnings |
298 [ | 300 [ |
299 (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"), | 301 (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"), |
300 ] | 302 ] |