mirror of
https://github.com/ovh/debian-cis.git
synced 2025-06-21 18:23:42 +02:00
IMP: new tag in file to tell that the script should pass shellcheck
The `# run-shellchek` tag must be placed in the first 10 lines of the file
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
#!/bin/bash
|
||||
# run-shellcheck
|
||||
# usage : $0 [shell script to check]
|
||||
# called without arguments, il will shellcheck any *.sh file found in the project
|
||||
set -e
|
||||
|
||||
dockerfile="$(dirname "$0")/Dockerfile.shellcheck"
|
||||
|
@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# run-shellcheck
|
||||
# please do not run this script directly but `docker_build_and_run_shellcheck.sh`
|
||||
|
||||
files=""
|
||||
retval=0
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
files=$(find . -name "*.sh")
|
||||
@ -10,6 +12,11 @@ else
|
||||
fi
|
||||
|
||||
for f in $files; do
|
||||
printf "\e[1;36mRunning shellcheck on: %s \e[0m\n" "$f"
|
||||
/usr/bin/shellcheck --color=always --external-sources --shell=bash "$f"
|
||||
if head "$f" | grep -qE "^# run-shellcheck$"; then
|
||||
printf "\e[1;36mRunning shellcheck on: %s \e[0m\n" "$f"
|
||||
if ! /usr/bin/shellcheck --color=always --external-sources --shell=bash "$f"; then
|
||||
retval=$((retval + 1))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
exit "$retval"
|
||||
|
Reference in New Issue
Block a user