diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -319,9 +319,9 @@ "use util.readfile() instead"), (r'[\s\(](open|file)\([^)]*\)\.write\(', "use util.writefile() instead"), - (r'^[\s\(]*(open(er)?|file)\([^)]*\)', + (r'^[\s\(]*(open(er)?|file)\([^)]*\)(?!\.close\(\))', "always assign an opened file to a variable, and close it afterwards"), - (r'[\s\(](open|file)\([^)]*\)\.', + (r'[\s\(](open|file)\([^)]*\)\.(?!close\(\))', "always assign an opened file to a variable, and close it afterwards"), (r'(?i)descend[e]nt', "the proper spelling is descendAnt"), (r'\.debug\(\_', "don't mark debug messages for translation"),