Mercurial > hg
comparison contrib/check-code.py @ 25661:20de1ace07a9
check-code: detect legacy exception syntax
We just rewrote all files to use modern exception syntax. Ban the old
form.
This will detect the "except type, instance" and
"except (type1, type2), instance" forms.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 23 Jun 2015 22:20:01 -0700 |
parents | 328739ea70c3 |
children | b80b2ee71a08 |
comparison
equal
deleted
inserted
replaced
25660:328739ea70c3 | 25661:20de1ace07a9 |
---|---|
279 "always assign an opened file to a variable, and close it afterwards"), | 279 "always assign an opened file to a variable, and close it afterwards"), |
280 (r'(?i)descend[e]nt', "the proper spelling is descendAnt"), | 280 (r'(?i)descend[e]nt', "the proper spelling is descendAnt"), |
281 (r'\.debug\(\_', "don't mark debug messages for translation"), | 281 (r'\.debug\(\_', "don't mark debug messages for translation"), |
282 (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"), | 282 (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"), |
283 (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'), | 283 (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'), |
284 (r'^\s*except\s([^\(,]+|\([^\)]+\))\s*,', | |
285 'legacy exception syntax; use "as" instead of ","'), | |
284 (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"), | 286 (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"), |
285 (r'ui\.(status|progress|write|note|warn)\([\'\"]x', | 287 (r'ui\.(status|progress|write|note|warn)\([\'\"]x', |
286 "missing _() in ui message (use () to hide false-positives)"), | 288 "missing _() in ui message (use () to hide false-positives)"), |
287 (r'release\(.*wlock, .*lock\)', "wrong lock release order"), | 289 (r'release\(.*wlock, .*lock\)', "wrong lock release order"), |
288 (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"), | 290 (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"), |