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

Add presubmit check for tabs in html files. #744

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

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

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

tabcheck:
@CHANGES="$$(awk '/\t/ {print FILENAME,FNR}' $(HTML_FILES))"; \
if [ -n "$${CHANGES}" ]; then \
echo "$${CHANGES}\n\n"; \
exit 1; \
fi
.PHONY: tabcheck

spellcheck:
@command -v misspell > /dev/null 2>&1 || go get github.com/client9/misspell/cmd/misspell
@misspell -locale="US" -error -source="text" **/*
Expand Down
7 changes: 7 additions & 0 deletions scripts/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ make spellcheck || {
}


echo "↹ Verify tabs"
make tabcheck || {
echo "✋ Found tabs in html."
exit 1
}


echo "🔨 Building"
go build ./...

Expand Down