-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlint.sh
More file actions
79 lines (67 loc) · 1.32 KB
/
lint.sh
File metadata and controls
79 lines (67 loc) · 1.32 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Read the command line options
TEMP="$(getopt -n 'lint' -o 'dsya' --long 'lint-docker,lint-shell,lint-yaml,lint-all' -- "${@}")"
eval set -- "${TEMP}"
# Set up the defaults
LINT_DOCKER="0"
LINT_SHELL="0"
LINT_YAML="0"
while [ ${#} -gt 0 ]
do
case "${1}" in
'-d' | '--lint-docker')
LINT_DOCKER="1"
shift
;;
'-s' | '--lint-shell')
LINT_SHELL="1"
shift
;;
'-y' | '--lint-yaml')
LINT_YAML="1"
shift
;;
'-a' | '--lint-all')
LINT_DOCKER="1"
LINT_SHELL="1"
LINT_YAML="1"
shift
;;
'--')
shift
break
;;
*)
exit 1
esac
done
# Lint all if none specified
if [ "${LINT_DOCKER}" == "0" ] \
&& [ "${LINT_SHELL}" == "0" ] \
&& [ "${LINT_YAML}" == "0" ]
then
LINT_DOCKER="1"
LINT_SHELL="1"
LINT_YAML="1"
fi
if [ "${LINT_DOCKER}" == "1" ]
then
hadolint \
'Dockerfile' \
'Dockerfile.user.j2'
fi
if [ "${LINT_SHELL}" == "1" ]
then
shellcheck \
'entrypoint.sh' \
'start-container' \
'install_pip' \
'build.sh' \
'lint.sh'
fi
if [ "${LINT_YAML}" == "1" ]
then
yamllint '.'
fi