2020-12-14 17:12:57 +00:00
|
|
|
#!/bin/sh
|
2020-09-09 11:03:27 +00:00
|
|
|
|
2020-12-14 17:12:57 +00:00
|
|
|
set -e -f -u
|
2020-07-15 09:49:08 +00:00
|
|
|
|
2021-06-28 15:24:33 +00:00
|
|
|
# Show all temporary todos to the programmer but don't fail the commit
|
|
|
|
# if there are any, because the commit could be in a temporary branch.
|
2021-07-29 14:40:31 +00:00
|
|
|
git grep -e 'TODO.*!!' -- ':!scripts/hooks/pre-commit' | cat || :
|
|
|
|
|
|
|
|
verbose="${VERBOSE:-0}"
|
|
|
|
readonly verbose
|
2021-06-28 15:24:33 +00:00
|
|
|
|
2021-05-19 17:31:20 +00:00
|
|
|
if [ "$( git diff --cached --name-only -- 'client/*.js' )" ]
|
2020-12-14 17:12:57 +00:00
|
|
|
then
|
2021-07-29 14:40:31 +00:00
|
|
|
make VERBOSE="$verbose" js-lint js-test
|
2020-07-15 09:49:08 +00:00
|
|
|
fi
|
|
|
|
|
2021-05-19 17:31:20 +00:00
|
|
|
if [ "$( git diff --cached --name-only -- 'client2/*.js' 'client2/*.ts' 'client2/*.tsx' )" ]
|
2021-01-28 11:02:38 +00:00
|
|
|
then
|
2021-07-29 14:40:31 +00:00
|
|
|
make VERBOSE="$verbose" js-beta-lint js-beta-test
|
2021-01-28 11:02:38 +00:00
|
|
|
fi
|
|
|
|
|
2021-05-19 17:31:20 +00:00
|
|
|
if [ "$( git diff --cached --name-only -- '*.go' '*.mod' '*.sh' 'Makefile' )" ]
|
2020-12-14 17:12:57 +00:00
|
|
|
then
|
2021-07-29 14:40:31 +00:00
|
|
|
make VERBOSE="$verbose" go-os-check go-lint go-test
|
2020-12-14 17:12:57 +00:00
|
|
|
fi
|
2021-01-14 10:48:52 +00:00
|
|
|
|
2021-05-19 17:31:20 +00:00
|
|
|
if [ "$( git diff --cached --name-only -- '*.md' '*.yaml' '*.yml' )" ]
|
|
|
|
then
|
2021-07-29 14:40:31 +00:00
|
|
|
make VERBOSE="$verbose" txt-lint
|
2021-05-19 17:31:20 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$( git diff --cached --name-only -- './openapi/openapi.yaml' )" ]
|
2021-01-14 10:48:52 +00:00
|
|
|
then
|
2021-07-29 14:40:31 +00:00
|
|
|
make VERBOSE="$verbose" openapi-lint
|
2021-01-14 10:48:52 +00:00
|
|
|
fi
|