-
Notifications
You must be signed in to change notification settings - Fork 5
/
quality
executable file
·24 lines (19 loc) · 1.35 KB
/
quality
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
set -e -o pipefail
ANALYSE_PATH="${1-}"
if ! docker image ls -a --format '{{ print .Repository ":" .Tag }}' | grep -q koalaman/shellcheck-alpine:stable; then
docker pull koalaman/shellcheck-alpine:stable
fi
if ! docker image ls -a --format '{{ print .Repository ":" .Tag }}' | grep -q hadolint/hadolint:latest; then
docker pull hadolint/hadolint:latest-alpine
fi
run_shellcheck()
{
docker run --rm --volume "$(pwd):/app" koalaman/shellcheck-alpine:stable /bin/sh -c "find '/app/$ANALYSE_PATH' -type f ! -path '*/application/skeleton/bin/console' ! -path '*/docker/image/console/root/usr/bin/strip-magento-config' ! -path '*/docker/image/console/root/usr/bin/validate-magento-config' ! -path '*/.git/*' ! -path '/app/dist/*' ! -path '/app/tmp-test/*' ! -path '/app/test/*' ! -name '*.xml' ! -name '*.txt' ! -name '*.properties' ! -name '*.twig' -and \( -name "*.sh" -or -perm -0111 \) -print -exec shellcheck --exclude=SC1008,SC1091 {} +"
}
run_hadolint()
{
docker run --rm --volume "$(pwd):/app" hadolint/hadolint:latest-alpine /bin/sh -c "find '/app/$ANALYSE_PATH' -type f -name '*Dockerfile' ! -path '*/.git/*' ! -path '/app/dist/*' ! -path '/app/tmp-test/*' ! -path '/app/test/*' ! -name '*.orig' -print -exec hadolint --ignore DL3003 --ignore DL3008 --ignore DL3016 --ignore SC1091 --ignore DL3002 --ignore DL3006 {} +"
}
run_shellcheck
run_hadolint