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

Commit

Permalink
Add presubmit check for tabs in html files. (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfaller authored Oct 6, 2020
1 parent b7546f2 commit 53810ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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

0 comments on commit 53810ad

Please sign in to comment.