Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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.
  • Loading branch information
nikomatsakis committed Jan 25, 2013
commit 03e9e4f5f99265f88dee1b9d1b3f624a10d7e40e
8 changes: 8 additions & 0 deletions src/etc/tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -44,6 +49,9 @@ def do_license_check(name, contents):
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")
Expand Down