diff --git a/bin/php-cs-fixer b/bin/php-cs-fixer new file mode 120000 index 0000000000..3cbdebad71 --- /dev/null +++ b/bin/php-cs-fixer @@ -0,0 +1 @@ +../vendor/bin/php-cs-fixer \ No newline at end of file diff --git a/bin/php-doc-check b/bin/php-doc-check new file mode 120000 index 0000000000..3ac95ac285 --- /dev/null +++ b/bin/php-doc-check @@ -0,0 +1 @@ +../vendor/bin/php-doc-check \ No newline at end of file diff --git a/bin/pre-commit b/bin/pre-commit index 704de44dad..dae2bc89b9 100755 --- a/bin/pre-commit +++ b/bin/pre-commit @@ -1,10 +1,10 @@ + #!/usr/bin/env bash -# get the list of changed files -staged_files=$(git diff --cached --name-only) +root="$(git rev-parse --show-toplevel)" -# build command to fix files -cmd="$(git rev-parse --show-toplevel)/vendor/bin/php-cs-fixer" +# get the list of changed files +staged_files="$(git diff --cached --name-only)" echo "Running php-cs-fixer on edited files" @@ -12,7 +12,7 @@ for staged in ${staged_files}; do # work only with existing files if [[ -f ${staged} && ${staged} == *.php ]]; then # 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 [[ $? -eq 0 ]]; then @@ -21,4 +21,9 @@ for staged in ${staged_files}; do fi 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 $?