Mercurial > hg
changeset 13074:637627f31c74
check-code: check for gratuitous whitespace after Python keywords
author | Thomas Arendsen Hein <thomas@jtah.de> |
---|---|
date | Fri, 03 Dec 2010 11:23:38 +0100 |
parents | 8c6b7a5f38c4 |
children | d73c3034deee |
files | contrib/check-code.py |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Wed Dec 01 18:47:40 2010 -0600 +++ b/contrib/check-code.py Fri Dec 03 11:23:38 2010 +0100 @@ -8,6 +8,7 @@ # GNU General Public License version 2 or any later version. import re, glob, os, sys +import keyword import optparse def repquote(m): @@ -136,6 +137,8 @@ (r'(?<!def)\s+(callable)\(', "callable not available in Python 3, use hasattr(f, '__call__')"), (r'if\s.*\selse', "if ... else form not available in Python 2.4"), + (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist), + "gratuitous whitespace after Python keyword"), (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"), # (r'\s\s=', "gratuitous whitespace before ="), (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',