Mercurial > public > mercurial-scm > hg-stable
comparison contrib/check-code.py @ 10287:5da892be3497
check-code: add some ignore hints
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 28 Jan 2010 22:44:18 -0600 |
parents | cc0340ef47f7 |
children | 7cc60de189d7 |
comparison
equal
deleted
inserted
replaced
10286:cc0340ef47f7 | 10287:5da892be3497 |
---|---|
133 for name, match, filters, pats in checks: | 133 for name, match, filters, pats in checks: |
134 fc = 0 | 134 fc = 0 |
135 if not re.match(match, f): | 135 if not re.match(match, f): |
136 continue | 136 continue |
137 pre = post = open(f).read() | 137 pre = post = open(f).read() |
138 if "no-" + "check-code" in pre: | |
139 break | |
138 for p, r in filters: | 140 for p, r in filters: |
139 post = re.sub(p, r, post) | 141 post = re.sub(p, r, post) |
140 # print post # uncomment to show filtered version | 142 # print post # uncomment to show filtered version |
141 z = enumerate(zip(pre.splitlines(), post.splitlines(True))) | 143 z = enumerate(zip(pre.splitlines(), post.splitlines(True))) |
142 for n, l in z: | 144 for n, l in z: |
145 if "check-code" + "-ignore" in l[0]: | |
146 continue | |
143 lc = 0 | 147 lc = 0 |
144 for p, msg in pats: | 148 for p, msg in pats: |
145 if re.search(p, l[1]): | 149 if re.search(p, l[1]): |
146 if not lc: | 150 if not lc: |
147 print "%s:%d:" % (f, n + 1) | 151 print "%s:%d:" % (f, n + 1) |