2019-12-20 17:26:26 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
|
2019-12-27 13:56:03 +00:00
|
|
|
SRC_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && cd .. && pwd)"
|
|
|
|
cd "$SRC_DIR"
|
|
|
|
rc=0
|
|
|
|
|
|
|
|
echo '# Linting shell scripts'
|
2019-12-20 17:26:26 +00:00
|
|
|
if ! docker --version >/dev/null 2>/dev/null; then
|
2019-12-27 13:56:03 +00:00
|
|
|
echo 'Docker is not installed, or it is not running.' >&2
|
|
|
|
rc=1
|
2020-01-23 14:01:25 +00:00
|
|
|
elif ! docker run --rm -v "$SRC_DIR:/src" -w /src --entrypoint /src/scripts/invoke-shfmt mvdan/shfmt:v3.0.1 fix; then
|
2019-12-27 13:56:03 +00:00
|
|
|
echo 'ERROR!' >&2
|
|
|
|
rc=1
|
2019-12-20 17:26:26 +00:00
|
|
|
fi
|
|
|
|
|
2019-12-27 13:56:03 +00: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 17:44:45 +00:00
|
|
|
fi
|
2019-12-27 13:56:03 +00:00
|
|
|
|
|
|
|
exit $rc
|