Merge with stable.
authorAugie Fackler <raf@durin42.com>
Tue, 05 Nov 2013 13:25:45 -0500
changeset 19983 e1317d3e59e1
parent 19982 3e1e4a8aec1e (diff)
parent 19980 0151b61fed97 (current diff)
child 19985 aa80446aacc3
Merge with stable.
contrib/check-code.py
--- a/contrib/check-code.py	Tue Nov 05 10:55:45 2013 +0100
+++ b/contrib/check-code.py	Tue Nov 05 13:25:45 2013 -0500
@@ -247,7 +247,7 @@
     (r'[\s\(](open|file)\([^)]*\)\.read\(',
      "use util.readfile() instead"),
     (r'[\s\(](open|file)\([^)]*\)\.write\(',
-     "use util.readfile() instead"),
+     "use util.writefile() instead"),
     (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
      "always assign an opened file to a variable, and close it afterwards"),
     (r'[\s\(](open|file)\([^)]*\)\.',
@@ -456,6 +456,8 @@
                 if prelines is None:
                     prelines = pre.splitlines()
                     postlines = post.splitlines(True)
+                    if i >= nerrs:
+                        msg = "warning: " + msg
 
                 start = m.start()
                 while n < len(postlines):
@@ -482,8 +484,6 @@
                         bl, bu, br = blamecache[n]
                         if bl == l:
                             bd = '%s@%s' % (bu, br)
-                if i >= nerrs:
-                    msg = "warning: " + msg
                 errors.append((f, lineno and n + 1, l, msg, bd))
                 result = False