# HG changeset patch # User Matt Mackall # Date 1265745204 21600 # Node ID 5326800d69376a719f6893f2c9ac324a1d134405 # Parent af4c42ec19edb74e7dba101c5d14669c13e315dd check-code: import some pylint checks diff -r af4c42ec19ed -r 5326800d6937 contrib/check-code.py --- 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 = [