[TOOLS] Don't fail commit when checking tools fail
This commit is contained in:
parent
ec28f23025
commit
29bb11e8bc
@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
root="$(git rev-parse --show-toplevel)"
|
root="$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
# get the list of changed files
|
# get the list of changed files that didn't get only partially added
|
||||||
staged_files="$(git status --porcelain | sed -rn "s/^[^ ][ ] (.*)/\1/p")"
|
staged_files="$(git status --porcelain | sed -rn "s/^[^ ][ ] (.*)/\1/p")"
|
||||||
|
|
||||||
if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_CS_FIX?}") 2>/dev/null); then
|
if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_CS_FIX?}") 2>/dev/null); then
|
||||||
echo "Running php-cs-fixer on edited files"
|
|
||||||
files=""
|
files=""
|
||||||
for staged in ${staged_files}; do
|
for staged in ${staged_files}; do
|
||||||
# work only with existing files
|
# work only with existing files
|
||||||
@ -16,18 +15,16 @@ if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_CS_FIX?}") 2>/dev/null);
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -n "${files}" ]; then
|
if [ -n "${files}" ]; then
|
||||||
prev="${PWD}"
|
echo "Running php-cs-fixer on edited files"
|
||||||
cd "${root}" && make cs-fixer "${files}" || exit 1
|
make cs-fixer "${files}"
|
||||||
cd "${prev}" || exit 1
|
git add "${files}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_DOC_CHECK?}") 2>/dev/null); then
|
if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_DOC_CHECK?}") 2>/dev/null); then
|
||||||
echo "Running php-doc-checker"
|
|
||||||
if echo "${staged_files}" | grep -F ".php" > /dev/null 2>&1; then
|
if echo "${staged_files}" | grep -F ".php" > /dev/null 2>&1; then
|
||||||
prev="${PWD}"
|
echo "Running php-doc-checker"
|
||||||
cd "${root}" && make doc-check < /dev/tty || exit 1
|
make doc-check < /dev/tty
|
||||||
cd "${prev}" || exit 1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user