changeset 19982:3e1e4a8aec1e

check-code: prepend warning prefix for repeated warnings only once When a warning occured several times in one file, "warning: " was prepended several times: examplefile.py:3: > def a(object): warning: this looks wrong examplefile.py:27: > def x(object): warning: warning: this looks wrong
author Simon Heimberg <simohe@besonet.ch>
date Sat, 02 Nov 2013 11:25:04 +0100
parents d1e14e7e5b40
children e1317d3e59e1
files contrib/check-code.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Sat Nov 02 11:25:33 2013 +0100
+++ b/contrib/check-code.py	Sat Nov 02 11:25:04 2013 +0100
@@ -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