diff contrib/check-code.py @ 19422:d9e86d656017

check-code: automatically preppend "warning: " to all warning messages Some warnings had "warning: " at the beginning of their message. Now this is done consistent for all messages. Especially in test-check-code-hg.t it is an advantage to see warnings at once because only exceptions to them are tolerated. It is (almost) as obvious as before a6180647ea. The prefix will not remain when a warning is changed to a failure. A change like a91387a37f will not be necessary anymore.
author Simon Heimberg <simohe@besonet.ch>
date Tue, 16 Jul 2013 01:29:14 +0200
parents 5aeb03b48ab4
children 3119dc155ac2
line wrap: on
line diff
--- a/contrib/check-code.py	Wed Jul 17 10:49:34 2013 +0200
+++ b/contrib/check-code.py	Tue Jul 16 01:29:14 2013 +0200
@@ -137,7 +137,7 @@
   # warnings
   [
     (r'^  [^*?/\n]* \(glob\)$',
-     "warning: glob match with no glob character (?*/)"),
+     "glob match with no glob character (?*/)"),
   ]
 ]
 
@@ -417,6 +417,7 @@
             break
         for p, r in filters:
             post = re.sub(p, r, post)
+        nerrs = len(pats[0]) # nerr elements are errors
         if warnings:
             pats = pats[0] + pats[1]
         else:
@@ -428,7 +429,7 @@
 
         prelines = None
         errors = []
-        for pat in pats:
+        for i, pat in enumerate(pats):
             if len(pat) == 3:
                 p, msg, ignore = pat
             else:
@@ -467,6 +468,8 @@
                         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