comparison contrib/check-code.py @ 17428:72803c8edaa4

avoid using abbreviations that look like spelling errors
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 27 Aug 2012 23:14:27 +0200
parents e7cfe3587ea4
children efd1a4378b64
comparison
equal deleted inserted replaced
17427:57c6c24b9bc4 17428:72803c8edaa4
134 (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"), 134 (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"),
135 (r'\w,\w', "missing whitespace after ,"), 135 (r'\w,\w', "missing whitespace after ,"),
136 (r'\w[+/*\-<>]\w', "missing whitespace in expression"), 136 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
137 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"), 137 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"),
138 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' 138 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
139 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'), 139 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'),
140 (r'.{81}', "line too long"), 140 (r'.{81}', "line too long"),
141 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), 141 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
142 (r'[^\n]\Z', "no trailing newline"), 142 (r'[^\n]\Z', "no trailing newline"),
143 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), 143 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
144 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', 144 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=',
188 "use True/False for constant Boolean expression"), 188 "use True/False for constant Boolean expression"),
189 (r'(?:(?<!def)\s+|\()hasattr', 189 (r'(?:(?<!def)\s+|\()hasattr',
190 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'), 190 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
191 (r'opener\([^)]*\).read\(', 191 (r'opener\([^)]*\).read\(',
192 "use opener.read() instead"), 192 "use opener.read() instead"),
193 (r'BaseException', 'not in Py2.4, use Exception'), 193 (r'BaseException', 'not in Python 2.4, use Exception'),
194 (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'), 194 (r'os\.path\.relpath', 'os.path.relpath is not in Python 2.5'),
195 (r'opener\([^)]*\).write\(', 195 (r'opener\([^)]*\).write\(',
196 "use opener.write() instead"), 196 "use opener.write() instead"),
197 (r'[\s\(](open|file)\([^)]*\)\.read\(', 197 (r'[\s\(](open|file)\([^)]*\)\.read\(',
198 "use util.readfile() instead"), 198 "use util.readfile() instead"),
199 (r'[\s\(](open|file)\([^)]*\)\.write\(', 199 (r'[\s\(](open|file)\([^)]*\)\.write\(',