badguardhome/scripts/hooks/pre-commit
Ainar Garipov 9d1656b5c1 Pull request: all: imp hacking, hooks
Merge in DNS/adguard-home from imp-hacking to master

Squashed commit of the following:

commit fcc0740526948256b5b356a3a7969e00baa35ff7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jun 28 18:16:57 2021 +0300

    all: imp hacking, hooks
2021-06-28 18:24:33 +03:00

33 lines
793 B
Bash
Executable File

#!/bin/sh
set -e -f -u
# 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.
git grep -e 'TODO.*!!' -- ':!HACKING.md' ':!scripts/hooks/pre-commit' | more || :
if [ "$( git diff --cached --name-only -- 'client/*.js' )" ]
then
make js-lint js-test
fi
if [ "$( git diff --cached --name-only -- 'client2/*.js' 'client2/*.ts' 'client2/*.tsx' )" ]
then
make js-beta-lint js-beta-test
fi
if [ "$( git diff --cached --name-only -- '*.go' '*.mod' '*.sh' 'Makefile' )" ]
then
make go-os-check go-lint go-test
fi
if [ "$( git diff --cached --name-only -- '*.md' '*.yaml' '*.yml' )" ]
then
make txt-lint
fi
if [ "$( git diff --cached --name-only -- './openapi/openapi.yaml' )" ]
then
make openapi-lint
fi