comparison contrib/check-code.py @ 14005:bb391e0515ba

check-code: warn about naked except clauses
author Idan Kamara <idankk86@gmail.com>
date Sat, 23 Apr 2011 00:52:21 +0300
parents 26f8844d1757
children 64de9ca66511
comparison
equal deleted inserted replaced
14004:97ed99d1f419 14005:bb391e0515ba
148 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', 148 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
149 "missing whitespace around operator"), 149 "missing whitespace around operator"),
150 (r'[^+=*!<>&| -](\s=|=\s)[^= ]', 150 (r'[^+=*!<>&| -](\s=|=\s)[^= ]',
151 "wrong whitespace around ="), 151 "wrong whitespace around ="),
152 (r'raise Exception', "don't raise generic exceptions"), 152 (r'raise Exception', "don't raise generic exceptions"),
153 (r'^\s*except:$', "warning: naked except clause"),
153 (r'ui\.(status|progress|write|note|warn)\([\'\"]x', 154 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
154 "warning: unwrapped ui message"), 155 "warning: unwrapped ui message"),
155 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), 156 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
156 (r' [=!]=\s+(True|False|None)', 157 (r' [=!]=\s+(True|False|None)',
157 "comparison with singleton, use 'is' or 'is not' instead"), 158 "comparison with singleton, use 'is' or 'is not' instead"),