Mercurial > hg-stable
changeset 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 | b2b08be5f556 |
children | 5046fede7684 |
files | contrib/check-code.py tests/test-check-code.t |
diffstat | 2 files changed, 15 insertions(+), 2 deletions(-) [+] |
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
--- a/tests/test-check-code.t Wed Jul 17 10:49:34 2013 +0200 +++ b/tests/test-check-code.t Tue Jul 16 01:29:14 2013 +0200 @@ -172,6 +172,16 @@ naked except clause [1] + $ cat > warning.t <<EOF + > $ function warnonly { + > > } + > EOF + $ "$check_code" warning.t + $ "$check_code" --warn warning.t + warning.t:1: + > $ function warnonly { + warning: don't use 'function', use old style + [1] $ cat > raise-format.py <<EOF > raise SomeException, message > # this next line is okay