changeset 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 ff5172c83002
files contrib/check-code.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Tue Jun 23 22:20:08 2015 -0700
+++ b/contrib/check-code.py	Tue Jun 23 22:20:01 2015 -0700
@@ -281,6 +281,8 @@
     (r'\.debug\(\_', "don't mark debug messages for translation"),
     (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"),
     (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'),
+    (r'^\s*except\s([^\(,]+|\([^\)]+\))\s*,',
+     'legacy exception syntax; use "as" instead of ","'),
     (r':\n(    )*( ){1,3}[^ ]', "must indent 4 spaces"),
     (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
      "missing _() in ui message (use () to hide false-positives)"),