comparison contrib/check-code.py @ 20005:22154ec6fb8b stable

check-code: prepend warning prefix only once, but for each warning The code adding the prefix is now run once per pattern. It was run once per file (after the change 3e1e4a8aec1e). Demonstrate that it is working now by extending the test. Raise two different warnings, one of them twice.
author Simon Heimberg <simohe@besonet.ch>
date Sat, 09 Nov 2013 10:21:20 +0100
parents 169cb9e47f8e
children a1d88278beff
comparison
equal deleted inserted replaced
20004:06e118c097ff 20005:22154ec6fb8b
465 if len(pat) == 3: 465 if len(pat) == 3:
466 p, msg, ignore = pat 466 p, msg, ignore = pat
467 else: 467 else:
468 p, msg = pat 468 p, msg = pat
469 ignore = None 469 ignore = None
470 if i >= nerrs:
471 msg = "warning: " + msg
470 472
471 pos = 0 473 pos = 0
472 n = 0 474 n = 0
473 for m in p.finditer(post): 475 for m in p.finditer(post):
474 if prelines is None: 476 if prelines is None:
498 blamecache = getblame(f) 500 blamecache = getblame(f)
499 if n < len(blamecache): 501 if n < len(blamecache):
500 bl, bu, br = blamecache[n] 502 bl, bu, br = blamecache[n]
501 if bl == l: 503 if bl == l:
502 bd = '%s@%s' % (bu, br) 504 bd = '%s@%s' % (bu, br)
503 if i >= nerrs: 505
504 msg = "warning: " + msg
505 errors.append((f, lineno and n + 1, l, msg, bd)) 506 errors.append((f, lineno and n + 1, l, msg, bd))
506 result = False 507 result = False
507 508
508 errors.sort() 509 errors.sort()
509 for e in errors: 510 for e in errors: