Add recursive linting

This commit is contained in:
Itamar Givon
2021-06-14 12:01:11 +02:00
parent 1fe9ddfd12
commit 34545a185d
2 changed files with 17 additions and 3 deletions
+12 -3
View File
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# The problem-matcher definition must be present in the repository
# checkout (outside the Docker container running hadolint). We create
@@ -27,5 +27,14 @@ for i in $HADOLINT_IGNORE; do
HADOLINT_IGNORE_CMDLINE="${HADOLINT_IGNORE_CMDLINE} --ignore=${i}"
done
# shellcheck disable=SC2086
hadolint $HADOLINT_IGNORE_CMDLINE $HADOLINT_CONFIG "$@"
if [ "$HADOLINT_RECURSIVE" = "true" ]; then
shopt -s globstar
filename="${!#}"
flags="${@:1:$#-1}"
hadolint $HADOLINT_IGNORE_CMDLINE $HADOLINT_CONFIG $flags **/$filename
else
# shellcheck disable=SC2086
hadolint $HADOLINT_IGNORE_CMDLINE $HADOLINT_CONFIG "$@"
fi