From patchwork Thu Mar 15 12:53:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D2864: contrib: open a hole in the open().read() ban for open().close() From: phabricator X-Patchwork-Id: 29530 Message-Id: <4386e492c257173e408e28012b28fc2d@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Thu, 15 Mar 2018 12:53:29 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHG1190449c807d: contrib: open a hole in the open().read() ban for open().close() (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2864?vs=7042&id=7059 REVISION DETAIL https://phab.mercurial-scm.org/D2864 AFFECTED FILES contrib/check-code.py CHANGE DETAILS To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel 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"),