blob: 71b3ab657693e68adf8b66b6571719afb2c87c63 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/bash
set -EeufCo pipefail
export SHELLOPTS # propagate set to children by default
IFS=$'\t\n'
# check required commands are in place
command -v shellcheck >/dev/null 2>&1 || { echo 'please install shellcheck'; exit 1; }
command -v hadolint >/dev/null 2>&1 || { echo 'please install hadolint'; exit 1; }
command -v yamllint >/dev/null 2>&1 || { echo 'please install yamllint'; exit 1; }
# check all the Dockerfiles with hadolint
find . \
-type f \
-name 'Dockerfile' \
-print0 |
xargs -0 -r hadolint
# check all the yaml files with yamllint
find . -type f \
-regex '.*\.ya?ml\(lint\)?' \
-print0 |
xargs -0 -r yamllint -s
# check all sh files with shellcheck
find . \
-type f \
-name '*.sh' \
-print0 |
xargs -0 -r shellcheck
|