check-code: two more rules
authorMatt Mackall <mpm@selenic.com>
Sat, 13 Feb 2010 23:20:17 -0600
changeset 10451 63a9bfad50ff
parent 10450 b4fd900569b1
child 10452 59f8fff4f887
check-code: two more rules - no plain Exceptions - complain about unmarked ui messages
contrib/check-code.py
--- a/contrib/check-code.py	Sun Feb 14 00:46:13 2010 +0200
+++ b/contrib/check-code.py	Sat Feb 13 23:20:17 2010 -0600
@@ -10,7 +10,8 @@
 import sys, re, glob
 
 def repquote(m):
-    t = re.sub(r"\S", "x", m.group(2))
+    t = re.sub(r"\w", "x", m.group(2))
+    t = re.sub(r"[^\sx]", "o", t)
     return m.group(1) + t + m.group(1)
 
 def repcomment(m):
@@ -88,6 +89,8 @@
     (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s', "missing whitespace around operator"),
     (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', "missing whitespace around operator"),
     (r'[^+=*!<>&| -](\s=|=\s)[^= ]', "wrong whitespace around ="),
+    (r'raise Exception', "don't raise generic exceptions"),
+    (r'ui\.(status|progress|write|note)\([\'\"]x', "unwrapped ui message"),
 ]
 
 pyfilters = [