Mercurial > public > mercurial-scm > hg-stable
diff contrib/check-code.py @ 28050:7e9e39228de6
check-code: examine magic pattern matching against contents of a file
Before this patch, check-code examines "magic" pattern (e.g.
'^#!.*python') matching against not contents of a file, but name of
it.
This unintentionally omits code checking against Python source file,
of which filename doesn't end with "*.py" or "*.cgi", even though
contents of it starts with "#!/bin/python" or so.
In this change, 'pre' refers contents of file 'f'.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 10 Feb 2016 22:44:29 +0900 |
parents | c65da6892ae5 |
children | 34a2944aac9b |
line wrap: on
line diff
--- a/contrib/check-code.py Wed Feb 10 22:44:29 2016 +0900 +++ b/contrib/check-code.py Wed Feb 10 22:44:29 2016 +0900 @@ -485,7 +485,7 @@ if debug: print name, f fc = 0 - if not (re.match(match, f) or (magic and re.search(magic, f))): + if not (re.match(match, f) or (magic and re.search(magic, pre))): if debug: print "Skipping %s for %s it doesn't match %s" % ( name, match, f)