[PATCH 05 of 10] check-code: disallow calling opener(...).read() and opener(..).write()

Dan Villiom Podlaski Christiansen danchr at gmail.com
Wed Dec 1 15:34:58 CST 2010


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1291227968 -3600
# Node ID ef3a4a0c604721a89f5f029f6ab3a3e1949928e2
# Parent  0df64bd75b64f1465c9e3e768373420267078d42
check-code: disallow calling opener(...).read() and opener(..).write()

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -152,6 +152,10 @@ pypats = [
     (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
     (r' [=!]=\s+(True|False|None)',
      "comparison with singleton, use 'is' or 'is not' instead"),
+    (r'opener\([^)]*\).read\(',
+     "use opener.read() instead"),
+    (r'opener\([^)]*\).write\(',
+     "use opener.write() instead"),
 ]
 
 pyfilters = [


More information about the Mercurial-devel mailing list