Merge pull request #851 from nextcloud/maintenance/git-hooks

Split checking hooks into commit and push
This commit is contained in:
Christian 2021-11-12 10:38:55 +01:00 коммит произвёл GitHub
Родитель 3446939b2e e9e0599fb4
Коммит 9574643cb5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 41 добавлений и 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

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

@ -19,6 +19,8 @@
[#848](https://github.com/nextcloud/cookbook/pull/848) @christianlupus
- Update PHP CS-Fixer
[#849](https://github.com/nextcloud/cookbook/pull/849) @christianlupus
- Update git hooks to not delay commits too much
[#851](https://github.com/nextcloud/cookbook/pull/851) @christianlupus
## 0.9.6 - 2021-10-18

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

@ -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",