changeset 10412:5326800d6937

check-code: import some pylint checks
author Matt Mackall <mpm@selenic.com>
date Tue, 09 Feb 2010 13:53:24 -0600
parents af4c42ec19ed
children e433002acb05
files contrib/check-code.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Wed Feb 10 17:42:57 2010 -0600
+++ b/contrib/check-code.py	Tue Feb 09 13:53:24 2010 -0600
@@ -60,7 +60,7 @@
 
 pypats = [
     (r'^\s*\t', "don't use tabs"),
-    (r'(\S\s+|^\s+)\n', "trailing whitespace"),
+    (r'\S;\s*\n', "semicolon"),
     (r'\w,\w', "missing whitespace after ,"),
     (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
     (r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"),
@@ -73,6 +73,7 @@
     (r'class\s[^(]:', "old-style class, use class foo(object)"),
     (r'^\s+del\(', "del isn't a function"),
     (r'^\s+except\(', "except isn't a function"),
+    (r',]', "unneeded trailing ',' in list"),
 #    (r'class\s[A-Z][^\(]*\((?!Exception)',
 #     "don't capitalize non-exception classes"),
 #    (r'in range\(', "use xrange"),
@@ -83,7 +84,10 @@
     (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
     (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"),
 #    (r'\s\s=', "gratuitous whitespace before ="),
-    (r'\S(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', "missing whitespace around operator")
+    (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', "missing whitespace around operator"),
+    (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s', "missing whitespace around operator"),
+    (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', "missing whitespace around operator"),
+    (r'[^+=*!<>&| -](\s=|=\s)[^= ]', "wrong whitespace around ="),
 ]
 
 pyfilters = [