Skip to content

Commit 4a726f0

Browse files
committed
auto merge of #8006 : emillon/rust/issue-6060, r=pcwalton
Hello, I made a tiny change to `tidy.py` so that it uses a regexp to find `// NOTE` comments. I could not find an easy way to write an automated test for this but if this is needed and possible I'd be happy to write one. Please note that it also removes extra empty lines that appear after each of these warnings (I believe that there were not wanted). On the performance side, `make tidy` is now a bit slower (running it 10 times in a row takes 71s on my machine, 65s before) but I don't think that it is performance sensitive. Thanks!
2 parents 330378d + b128ceb commit 4a726f0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/etc/tidy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def do_license_check(name, contents):
4949
report_err("FIXME without issue number")
5050
if line.find("TODO") != -1:
5151
report_err("TODO is deprecated; use FIXME")
52-
idx = line.find("// NOTE")
53-
if idx != -1:
54-
report_warn("NOTE" + line[idx + len("// NOTE"):])
52+
match = re.match(r'^.*//\s*(NOTE.*)$', line)
53+
if match:
54+
report_warn(match.group(1))
5555
if (line.find('\t') != -1 and
5656
fileinput.filename().find("Makefile") == -1):
5757
report_err("tab character")

0 commit comments

Comments
 (0)