diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -467,6 +467,8 @@ def checkfile(f, logfunc=_defaultlogger. else: p, msg = pat ignore = None + if i >= nerrs: + msg = "warning: " + msg pos = 0 n = 0 @@ -500,8 +502,7 @@ def checkfile(f, logfunc=_defaultlogger. 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 diff --git a/tests/test-check-code.t b/tests/test-check-code.t --- a/tests/test-check-code.t +++ b/tests/test-check-code.t @@ -185,12 +185,20 @@ $ cat > warning.t < $ function warnonly { > > } + > $ diff -N aaa + > $ function onwarn {} > EOF $ "$check_code" warning.t $ "$check_code" --warn warning.t warning.t:1: > $ function warnonly { warning: don't use 'function', use old style + warning.t:3: + > $ diff -N aaa + warning: don't use 'diff -N' + warning.t:4: + > $ function onwarn {} + warning: don't use 'function', use old style [1] $ cat > raise-format.py < raise SomeException, message