Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 730bdb6

Browse files
committedFeb 7, 2014
Added tests to make tidy
1 parent c3ccaac commit 730bdb6

File tree

321 files changed

+2730
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+2730
-148
lines changed
 

‎mk/tests.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
242242
tidy:
243243
@$(call E, check: formatting)
244244
$(Q)find $(S)src -name '*.r[sc]' \
245-
| grep '^$(S)src/test' -v \
246245
| grep '^$(S)src/libuv' -v \
247246
| grep '^$(S)src/llvm' -v \
248247
| grep '^$(S)src/gyp' -v \

‎src/etc/tidy.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
err=0
1616
cols=100
17+
cr_flag="xfail-tidy-cr"
18+
tab_flag="xfail-tidy-tab"
19+
linelength_flag="xfail-tidy-linelength"
1720

1821
# Be careful to support Python 2.4, 2.6, and 3.x here!
1922
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],
@@ -46,12 +49,22 @@ def do_license_check(name, contents):
4649

4750
current_name = ""
4851
current_contents = ""
52+
check_tab = True
53+
check_cr = True
54+
check_linelength = True
55+
4956

5057
try:
5158
for line in fileinput.input(file_names,
5259
openhook=fileinput.hook_encoded("utf-8")):
5360

5461
if fileinput.filename().find("tidy.py") == -1:
62+
if line.find(cr_flag) != -1:
63+
check_cr = False
64+
if line.find(tab_flag) != -1:
65+
check_tab = False
66+
if line.find(linelength_flag) != -1:
67+
check_linelength = False
5568
if line.find("// XXX") != -1:
5669
report_err("XXX is no longer necessary, use FIXME")
5770
if line.find("TODO") != -1:
@@ -72,16 +85,16 @@ def do_license_check(name, contents):
7285
if "SNAP" in line:
7386
report_warn("unmatched SNAP line: " + line)
7487

75-
if (line.find('\t') != -1 and
88+
if check_tab and (line.find('\t') != -1 and
7689
fileinput.filename().find("Makefile") == -1):
7790
report_err("tab character")
78-
if not autocrlf and line.find('\r') != -1:
91+
if check_cr and not autocrlf and line.find('\r') != -1:
7992
report_err("CR character")
8093
if line.endswith(" \n") or line.endswith("\t\n"):
8194
report_err("trailing whitespace")
8295
line_len = len(line)-2 if autocrlf else len(line)-1
8396

84-
if line_len > cols:
97+
if check_linelength and line_len > cols:
8598
report_err("line longer than %d chars" % cols)
8699

87100
if fileinput.isfirstline() and current_name != "":
@@ -90,6 +103,9 @@ def do_license_check(name, contents):
90103
if fileinput.isfirstline():
91104
current_name = fileinput.filename()
92105
current_contents = ""
106+
check_cr = True
107+
check_tab = True
108+
check_linelength = True
93109

94110
current_contents += line
95111

0 commit comments

Comments
 (0)
Please sign in to comment.