Mercurial > public > mercurial-scm > hg
comparison contrib/check-code.py @ 20239:16b5f498f49c
check-code: always report when a file is skipped by "no-check-code"
Skipping an entire file generally from checking is an important event, so
report it always.
Do not tell the check name because skipping does not depend on it. Directly
skip the entire file instead of checking more patterns and skip again.
The pragma no-check-code was introduced by accident in the past. (Fixed in
e033a7d444ac and ee07f9d142c9.) This now is prevented because the files
to skip have to be listed in the test output of test-check-code-hg.t.
author | Simon Heimberg <simohe@besonet.ch> |
---|---|
date | Tue, 07 Jan 2014 22:29:15 +0100 |
parents | 81e905790b30 |
children | 8071b4eddefa |
comparison
equal
deleted
inserted
replaced
20238:81e905790b30 | 20239:16b5f498f49c |
---|---|
439 print "Skipping %s, %s" % (f, str(e).split(':', 1)[0]) | 439 print "Skipping %s, %s" % (f, str(e).split(':', 1)[0]) |
440 continue | 440 continue |
441 pre = post = fp.read() | 441 pre = post = fp.read() |
442 fp.close() | 442 fp.close() |
443 if "no-" "check-code" in pre: | 443 if "no-" "check-code" in pre: |
444 if debug: | 444 print "Skipping %s it has no-" "check-code" % f |
445 print "Skipping %s for %s it has no-" "check-code" % ( | 445 return "Skip" # skip checking this file |
446 name, f) | |
447 break | |
448 for p, r in filters: | 446 for p, r in filters: |
449 post = re.sub(p, r, post) | 447 post = re.sub(p, r, post) |
450 nerrs = len(pats[0]) # nerr elements are errors | 448 nerrs = len(pats[0]) # nerr elements are errors |
451 if warnings: | 449 if warnings: |
452 pats = pats[0] + pats[1] | 450 pats = pats[0] + pats[1] |