##// END OF EJS Templates
check-code: disallow use of hasattr()...
Augie Fackler -
r14978:5a0fdc71 default
parent child Browse files
Show More
@@ -148,7 +148,7 b' pypats = ['
148 (r'(?<!def)\s+(any|all|format)\(',
148 (r'(?<!def)\s+(any|all|format)\(',
149 "any/all/format not available in Python 2.4"),
149 "any/all/format not available in Python 2.4"),
150 (r'(?<!def)\s+(callable)\(',
150 (r'(?<!def)\s+(callable)\(',
151 "callable not available in Python 3, use hasattr(f, '__call__')"),
151 "callable not available in Python 3, use getattr(f, '__call__', None)"),
152 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
152 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
153 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
153 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
154 "gratuitous whitespace after Python keyword"),
154 "gratuitous whitespace after Python keyword"),
@@ -168,6 +168,8 b' pypats = ['
168 "comparison with singleton, use 'is' or 'is not' instead"),
168 "comparison with singleton, use 'is' or 'is not' instead"),
169 (r'^\s*(while|if) [01]:',
169 (r'^\s*(while|if) [01]:',
170 "use True/False for constant Boolean expression"),
170 "use True/False for constant Boolean expression"),
171 (r'(?<!def)\s+hasattr',
172 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
171 (r'opener\([^)]*\).read\(',
173 (r'opener\([^)]*\).read\(',
172 "use opener.read() instead"),
174 "use opener.read() instead"),
173 (r'opener\([^)]*\).write\(',
175 (r'opener\([^)]*\).write\(',
General Comments 0
You need to be logged in to leave comments. Login now