Mercurial > public > mercurial-scm > hg-stable
comparison contrib/check-code.py @ 30245:01703a8b8a46 stable
check-code: discard filtering result of previous check for independence
Before this patch, check-code.py applies filtering on the file
content, to which filtering of previous check is already applied.
This might hide issues, which should be detected by a subsequent check
in "checks" list.
Fortunately, this problem hasn't appeared, because there is no
overlapping of filename matching (examined in the order below).
1. *.py or *.cgi
2. test-* (not *.t suffix)
3. *.c or *.h
4. *.t
5. *.txt
6. *.tmpl
For example, adding a test, which wants to examine raw comment text in
*.py files, at the end of current "checks" list doesn't work as
expected, because a filter for *.py files normalizes comment text in
them.
Putting such test at the beginning of "checks" list also resolves this
problem, but such dependence on the order decreases maintainability of
check-code.py itself.
This patch discards filtering result of previous check at the
beginning of each checks, for independence of each checks.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 01 Nov 2016 20:39:36 +0900 |
parents | 6ab838b20359 |
children | b4c0f8d5edd2 |
comparison
equal
deleted
inserted
replaced
30244:4e934804cafe | 30245:01703a8b8a46 |
---|---|
535 except IOError as e: | 535 except IOError as e: |
536 print("Skipping %s, %s" % (f, str(e).split(':', 1)[0])) | 536 print("Skipping %s, %s" % (f, str(e).split(':', 1)[0])) |
537 return result | 537 return result |
538 | 538 |
539 for name, match, magic, filters, pats in checks: | 539 for name, match, magic, filters, pats in checks: |
540 post = pre # discard filtering result of previous check | |
540 if debug: | 541 if debug: |
541 print(name, f) | 542 print(name, f) |
542 fc = 0 | 543 fc = 0 |
543 if not (re.match(match, f) or (magic and re.search(magic, pre))): | 544 if not (re.match(match, f) or (magic and re.search(magic, pre))): |
544 if debug: | 545 if debug: |