Split checking hooks into commit and push

Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Christian Wolf 2021-11-12 10:22:01 +01:00
Родитель 3446939b2e
Коммит 10c48aefe5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9FC3120E932F73F1
5 изменённых файлов: 39 добавлений и 19 удалений

Просмотреть файл

@ -11,8 +11,8 @@ extends:
- prettier
globals:
OC:
t:
OC: readonly
t: readonly
rules:
no-plusplus:

1
.gitignore поставляемый
Просмотреть файл

@ -8,6 +8,7 @@ cookbook.tar.gz
.idea/
/.php-cs-fixer.cache
/.eslintcache
# Built js package
js/*

Просмотреть файл

@ -14,20 +14,6 @@ cleanup() {
trap cleanup EXIT
if [ -e 'vendor/bin/php-cs-fixer' ]; then
composer cs:check || { echo "The PHP code is not validly formatted."; exit 1; }
fi
if [ -e 'node_modules/.bin/eslint' ]; then
npm run eslint || { echo 'The javascript code seems to be not satifying the eslint linter.'; exit 2; }
fi
if [ -e 'node_modules/.bin/prettier' ]; then
npm run prettier || { echo 'The javascript code seems to be not satifying the prettier code styler.'; exit 3; }
fi
if [ -e 'node_modules/.bin/stylelint' ]; then
npm run stylelint || { echo 'The CSS code seems to be not satifying the stylelint linter.'; exit 4; }
npm run --silent eslint || { echo 'The javascript code seems to be not satifying the eslint linter.'; exit 1; }
fi

33
.hooks/pre-push Executable file
Просмотреть файл

@ -0,0 +1,33 @@
#!/bin/sh
# set -x
lines_before=`git stash list | wc -l`
git stash push --keep-index -q
lines_after=`git stash list | wc -l`
cleanup() {
if [ $lines_before -lt $lines_after ]; then
git stash pop -q
fi
}
trap cleanup EXIT
if [ -e 'vendor/bin/php-cs-fixer' ]; then
composer cs:check || { echo "The PHP code is not validly formatted."; exit 1; }
fi
if [ -e 'node_modules/.bin/eslint' ]; then
npm run eslint || { echo 'The javascript code seems to be not satifying the eslint linter.'; exit 2; }
fi
if [ -e 'node_modules/.bin/prettier' ]; then
npm run prettier || { echo 'The javascript code seems to be not satifying the prettier code styler.'; exit 3; }
fi
if [ -e 'node_modules/.bin/stylelint' ]; then
npm run stylelint || { echo 'The CSS code seems to be not satifying the stylelint linter.'; exit 4; }
fi

Просмотреть файл

@ -12,8 +12,8 @@
"prettier-fix": "npx prettier --write src",
"stylelint": "npx stylelint src",
"stylelint-fix": "npx stylelint --fix src",
"eslint": "npx eslint src/**/*.{vue,js}",
"eslint-fix": "npx eslint --fix src/**/*.{vue,js}"
"eslint": "npx eslint --cache --cache-strategy content src/**/*.{vue,js}",
"eslint-fix": "npx eslint --cache --cache-strategy content --fix src/**/*.{vue,js}"
},
"repository": {
"type": "git",