##// END OF EJS Templates
check-code: disallow calling opener(...).read() and opener(..).write()
Dan Villiom Podlaski Christiansen -
r14169:1b4b8206 default
parent child Browse files
Show More
@@ -161,6 +161,18 b' pypats = ['
161 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
161 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
162 (r' [=!]=\s+(True|False|None)',
162 (r' [=!]=\s+(True|False|None)',
163 "comparison with singleton, use 'is' or 'is not' instead"),
163 "comparison with singleton, use 'is' or 'is not' instead"),
164 (r'opener\([^)]*\).read\(',
165 "use opener.read() instead"),
166 (r'opener\([^)]*\).write\(',
167 "use opener.write() instead"),
168 (r'[\s\(](open|file)\([^)]*\)\.read\(',
169 "use util.readfile() instead"),
170 (r'[\s\(](open|file)\([^)]*\)\.write\(',
171 "use util.readfile() instead"),
172 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
173 "always assign an opened file to a variable, and close it afterwards"),
174 (r'[\s\(](open|file)\([^)]*\)\.',
175 "always assign an opened file to a variable, and close it afterwards"),
164 ],
176 ],
165 # warnings
177 # warnings
166 [
178 [
General Comments 0
You need to be logged in to leave comments. Login now