# HG changeset patch # User Mads Kiilerich # Date 1335139008 -7200 # Node ID 5f9835ed3d6d9e995b6fef71932973fef9df467c # Parent e1f0305eabe43922c28d0f83376b5049299a6c39 check-code: put grouping around regexps generated from testpats This removes the pitfall that would make the testpath r'a|b' match 'b' on all lines in .t tests. diff -r e1f0305eabe4 -r 5f9835ed3d6d contrib/check-code.py --- a/contrib/check-code.py Mon Apr 23 01:56:48 2012 +0200 +++ b/contrib/check-code.py Mon Apr 23 01:56:48 2012 +0200 @@ -43,7 +43,7 @@ testpats = [ [ - (r'(pushd|popd)', "don't use 'pushd' or 'popd', use 'cd'"), + (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"), (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"), (r'^function', "don't use 'function', use old style"), (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"), @@ -108,9 +108,9 @@ for i in [0, 1]: for p, m in testpats[i]: if p.startswith(r'^'): - p = uprefix + p[1:] + p = r"^ \$ (%s)" % p[1:] else: - p = uprefix + ".*" + p + p = r"^ \$ .*(%s)" % p utestpats[i].append((p, m)) utestfilters = [