From 0004be9ecad4ce489b84036589cb62e42ce880bb Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 24 Jan 2013 22:03:29 -0800 Subject: [PATCH] Detect "// WARN" in tidy and print out, well, a warning! Useful for notating FIXME-style-situations that you want to be reminded of before you commit. r=catamorphism --- src/etc/tidy.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/etc/tidy.py b/src/etc/tidy.py index e866d80062d5..a823bbb22772 100644 --- a/src/etc/tidy.py +++ b/src/etc/tidy.py @@ -23,6 +23,11 @@ def report_error_name_no(name, no, s): def report_err(s): report_error_name_no(fileinput.filename(), fileinput.filelineno(), s) +def report_warn(s): + print("%s:%d: %s" % (fileinput.filename(), + fileinput.filelineno(), + s)) + def do_license_check(name, contents): if not check_license(name, contents): report_error_name_no(name, 1, "incorrect license") @@ -44,6 +49,9 @@ try: report_err("FIXME without issue number") if line.find("TODO") != -1: report_err("TODO is deprecated; use FIXME") + if line.find("// WARN") != -1: + mo = re.match("// WARN (.*)", line) + report_warn("WARN: " + mo.group(1)) if (line.find('\t') != -1 and fileinput.filename().find("Makefile") == -1): report_err("tab character")