[HOOKS] Update pre-commit script to check for missing documentation in functions
This commit is contained in:
parent
de8fa87079
commit
67d4702743
1
bin/php-cs-fixer
Symbolic link
1
bin/php-cs-fixer
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../vendor/bin/php-cs-fixer
|
1
bin/php-doc-check
Symbolic link
1
bin/php-doc-check
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../vendor/bin/php-doc-check
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# get the list of changed files
|
root="$(git rev-parse --show-toplevel)"
|
||||||
staged_files=$(git diff --cached --name-only)
|
|
||||||
|
|
||||||
# build command to fix files
|
# get the list of changed files
|
||||||
cmd="$(git rev-parse --show-toplevel)/vendor/bin/php-cs-fixer"
|
staged_files="$(git diff --cached --name-only)"
|
||||||
|
|
||||||
echo "Running php-cs-fixer on edited files"
|
echo "Running php-cs-fixer on edited files"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ for staged in ${staged_files}; do
|
||||||
# work only with existing files
|
# work only with existing files
|
||||||
if [[ -f ${staged} && ${staged} == *.php ]]; then
|
if [[ -f ${staged} && ${staged} == *.php ]]; then
|
||||||
# use php-cs-fixer and get flag of correction
|
# use php-cs-fixer and get flag of correction
|
||||||
"${cmd}" -q fix "${staged}"
|
"${root}/bin/php-cs-fixer" -q fix "${staged}"
|
||||||
|
|
||||||
# if php-cs-fixer fix works, it returns 0
|
# if php-cs-fixer fix works, it returns 0
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
|
@ -21,4 +21,9 @@ for staged in ${staged_files}; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
exit 0 # do commit
|
echo "Running php-doc-checker"
|
||||||
|
|
||||||
|
"${root}/bin/php-doc-check" src plugins components
|
||||||
|
|
||||||
|
# Only commit if there wasn't an error
|
||||||
|
exit $?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user