docker-php-extension-installer/scripts/lint

31 lines
724 B
Plaintext
Raw Normal View History

#!/bin/sh
set -o errexit
set -o nounset
2019-12-27 14:56:03 +01:00
SRC_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && cd .. && pwd)"
cd "$SRC_DIR"
rc=0
echo '# Linting shell scripts'
if ! docker --version >/dev/null 2>/dev/null; then
2019-12-27 14:56:03 +01:00
echo 'Docker is not installed, or it is not running.' >&2
rc=1
2021-10-07 15:34:51 +02:00
elif ! docker run --rm -v "$SRC_DIR:/src" -w /src --entrypoint /src/scripts/invoke-shfmt mvdan/shfmt:v3.4.0-alpine fix; then
2019-12-27 14:56:03 +01:00
echo 'ERROR!' >&2
rc=1
fi
2019-12-27 14:56:03 +01:00
echo '# Linting PHP files'
if ! composer --version >/dev/null 2>/dev/null; then
echo 'Composer is not installed.' >&2
elif ! test -f ./vendor/autoload.php; then
echo 'Composer dependencies are not installed.' >&2
rc=1
elif ! composer run-script lint; then
echo 'ERROR!' >&2
rc=1
2019-12-20 18:44:45 +01:00
fi
2019-12-27 14:56:03 +01:00
exit $rc