##// END OF EJS Templates
check-code: disallow two-argument form of raise...
Augie Fackler -
r18180:c582a714 default
parent child Browse files
Show More
@@ -185,6 +185,8 b' pypats = ['
185 (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]',
185 (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]',
186 "wrong whitespace around ="),
186 "wrong whitespace around ="),
187 (r'raise Exception', "don't raise generic exceptions"),
187 (r'raise Exception', "don't raise generic exceptions"),
188 (r'raise [^,(]+, (\([^\)]+\)|[^,\(\)]+)$',
189 "don't use old-style two-argument raise, use Exception(message)"),
188 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
190 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
189 (r' [=!]=\s+(True|False|None)',
191 (r' [=!]=\s+(True|False|None)',
190 "comparison with singleton, use 'is' or 'is not' instead"),
192 "comparison with singleton, use 'is' or 'is not' instead"),
@@ -159,3 +159,14 b''
159 > except:
159 > except:
160 warning: naked except clause
160 warning: naked except clause
161 [1]
161 [1]
162
163 $ cat > raise-format.py <<EOF
164 > raise SomeException, message
165 > # this next line is okay
166 > raise SomeException(arg1, arg2)
167 > EOF
168 $ "$check_code" raise-format.py
169 raise-format.py:1:
170 > raise SomeException, message
171 don't use old-style two-argument raise, use Exception(message)
172 [1]
General Comments 0
You need to be logged in to leave comments. Login now