Skip to content

Commit 03e9e4f

Browse files
committed
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.
1 parent 403f33f commit 03e9e4f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/etc/tidy.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def report_error_name_no(name, no, s):
2323
def report_err(s):
2424
report_error_name_no(fileinput.filename(), fileinput.filelineno(), s)
2525

26+
def report_warn(s):
27+
print("%s:%d: %s" % (fileinput.filename(),
28+
fileinput.filelineno(),
29+
s))
30+
2631
def do_license_check(name, contents):
2732
if not check_license(name, contents):
2833
report_error_name_no(name, 1, "incorrect license")
@@ -44,6 +49,9 @@ def do_license_check(name, contents):
4449
report_err("FIXME without issue number")
4550
if line.find("TODO") != -1:
4651
report_err("TODO is deprecated; use FIXME")
52+
if line.find("// WARN") != -1:
53+
mo = re.match("// WARN (.*)", line)
54+
report_warn("WARN: " + mo.group(1))
4755
if (line.find('\t') != -1 and
4856
fileinput.filename().find("Makefile") == -1):
4957
report_err("tab character")

0 commit comments

Comments
 (0)