Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Commit 53810ad

Browse files
authored
Add presubmit check for tabs in html files. (#744)
1 parent b7546f2 commit 53810ad

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Makefile

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

1515
VETTERS = "asmdecl,assign,atomic,bools,buildtag,cgocall,composites,copylocks,errorsas,httpresponse,loopclosure,lostcancel,nilfunc,printf,shift,stdmethods,structtag,tests,unmarshal,unreachable,unsafeptr,unusedresult"
1616
GOFMT_FILES = $(shell go list -f '{{.Dir}}' ./...)
17+
HTML_FILES = $(shell find . -name \*.html)
1718

1819
fmtcheck:
1920
@command -v goimports > /dev/null 2>&1 || go get golang.org/x/tools/cmd/goimports
@@ -30,6 +31,14 @@ fmtcheck:
3031
fi
3132
.PHONY: fmtcheck
3233

34+
tabcheck:
35+
@CHANGES="$$(awk '/\t/ {print FILENAME,FNR}' $(HTML_FILES))"; \
36+
if [ -n "$${CHANGES}" ]; then \
37+
echo "$${CHANGES}\n\n"; \
38+
exit 1; \
39+
fi
40+
.PHONY: tabcheck
41+
3342
spellcheck:
3443
@command -v misspell > /dev/null 2>&1 || go get github.com/client9/misspell/cmd/misspell
3544
@misspell -locale="US" -error -source="text" **/*

scripts/presubmit.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ make spellcheck || {
5353
}
5454

5555

56+
echo "↹ Verify tabs"
57+
make tabcheck || {
58+
echo "✋ Found tabs in html."
59+
exit 1
60+
}
61+
62+
5663
echo "🔨 Building"
5764
go build ./...
5865

0 commit comments

Comments
 (0)