Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 5eeb49e9 authored by Christophe Chaudier's avatar Christophe Chaudier :rocket:
Browse files

Merge branch '72-fix-job-bash-lint' into 'master'

Resolve "fix: job bash-lint"

Closes #72

See merge request lydra/gitlab-ci-templates!54
parents fb1c7a99 216a352f
No related branches found
No related tags found
No related merge requests found
Pipeline #35778 failed
......@@ -2,19 +2,18 @@
bash-lint:
extends: .base_tpl
stage: lint
image: registry.gitlab.com/pipeline-components/shellcheck:latest
variables:
files_to_lint: ""
script: |
_shellcheck () {
echo "----> lint script $1"
docker run --rm \
-v "$(pwd):/mnt/" \
-v "/tmp:/tmp_ro":ro \
koalaman/shellcheck $1
}
for script in $(find . -name "*.sh"); do
_shellcheck $script
done
for script in $files_to_lint; do
_shellcheck $script
done
script:
- if [[ ${files_to_lint} != "" ]]; then shellcheck ${files_to_lint}; fi
# anything ending on .sh, should be shell script
- |
find . -name .git -type d -prune -o -type f -name \*.sh -print0 |
xargs -0 -P $(nproc) -r -n1 shellcheck
# magic, any file with a valid shebang should be scanned aswell
- |
find . -name .git -type d -prune -o -type f -regex '.*/[^.]*$' -print0 |
xargs -0 -P $(nproc) -r -n1 sh -c 'FILE="$0"; if head -n1 "$FILE" |
grep -q "^#\\! \?/.\+\(ba|d|k\)\?sh" ; then shellcheck "$FILE" ;
else /bin/true ; fi '
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment