mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Add misspell and gofmt simplify to the pre-commit hooks (#138)
This commit is contained in:
parent
7cbdab30f4
commit
472155837b
8 changed files with 25 additions and 10 deletions
|
@ -3,7 +3,21 @@
|
|||
set -eu
|
||||
|
||||
golint src/...
|
||||
go fmt ./src/...
|
||||
misspell -error src *.md
|
||||
|
||||
# gofmt doesn't exit with an error code if the files don't match the expected
|
||||
# format. So we have to run it and see if it outputs anything.
|
||||
if gofmt -l -s ./src/ 2>&1 | read
|
||||
then
|
||||
echo "Error: not all code had been formatted with gofmt."
|
||||
echo "Fixing the following files"
|
||||
gofmt -s -w -l ./src/
|
||||
echo
|
||||
echo "Please add them to the commit"
|
||||
git status --short
|
||||
exit 1
|
||||
fi
|
||||
|
||||
go tool vet --all --shadow ./src
|
||||
gocyclo -over 12 src/
|
||||
gb test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue