[PATCH 3 of 4 STABLE] check-code: discard filtering result of previous check for independence
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Tue Nov 1 07:47:33 EDT 2016
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1478000376 -32400
# Tue Nov 01 20:39:36 2016 +0900
# Branch stable
# Node ID a870b49662d84c4c532e4c1fde2987b782b4ed88
# Parent 4cc5a1e982f91d009e00068e9a0f876e03afbf45
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.
diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -537,6 +537,7 @@ def checkfile(f, logfunc=_defaultlogger.
return result
for name, match, magic, filters, pats in checks:
+ post = pre # discard filtering result of previous check
if debug:
print(name, f)
fc = 0
More information about the Mercurial-devel
mailing list