[PATCH 3 of 4] check-code: improve detection of naked except clauses

Brodie Rao brodie at sf.io
Sun May 13 06:20:07 CDT 2012


# HG changeset patch
# User Brodie Rao <brodie at sf.io>
# Date 1336907870 -7200
# Node ID 67e08b0c77dcf882267988c9008a9621dc801ee8
# Parent  934247319294cb96997a17f3ad39211795d972b0
check-code: improve detection of naked except clauses

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -206,7 +206,7 @@ pypats = [
   ],
   # warnings
   [
-    (r'^\s*except:$', "warning: naked except clause"),
+    (r'^\s*except\s*:', "warning: naked except clause"),
     (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
      "warning: unwrapped ui message"),
   ]


More information about the Mercurial-devel mailing list