Files
piratepoet/mailpoet/tasks/lint-staged-php.sh
Mustapha Hadid d90f0ae533 Fix unresolved command in lint-staged-php for Linux
The 'source' command is not available in the default sh shell on Linux. The source command is specific to bash and other compatible shells. On Linux, the default sh shell is often dash, which does not support source. It seem to work on macOS because the default shell there is bash.

The . (dot) command is POSIX-compliant and works in both sh and bash.
2024-09-06 09:25:14 +02:00

30 lines
616 B
Bash
Executable File

#!/bin/sh
set -e
. $PWD/.env
if [ "$MP_GIT_HOOKS_ENABLE" != "true" ]; then
echo "MP_GIT_HOOKS_ENABLE is not set to 'true'. Skipping lint-staged-php."
exit 0
fi
if [ "$MP_GIT_HOOKS_PHPLINT" = "true" ]; then
phplint $@
else
echo "MP_GIT_HOOKS_PHPLINT not set to 'true', skipping phplint"
fi
if [ "$MP_GIT_HOOKS_CODE_SNIFFER" = "true" ]; then
./do qa:code-sniffer $@
else
echo "MP_GIT_HOOKS_CODE_SNIFFER not set to 'true', skipping code sniffer"
fi
if [ "$MP_GIT_HOOKS_PHPSTAN" = "true" ]; then
bash -c './do qa:phpstan' $@
else
echo "MP_GIT_HOOKS_PHPSTAN not set to 'true', skipping PHPStan"
fi