This repository was archived by the owner on Apr 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # @description Run bash linter
4+ #
5+ # @example
6+ # run-bash-linter
7+ #
8+ # @arg $1 Task: "brief", "help" or "exec"
9+ #
10+ # @exitcode The result of the shellckeck
11+ #
12+ # @stdout "Not implemented" message if the requested task is not implemented
13+ #
14+ function run-bash-linter() {
15+
16+ # Init
17+ local briefMessage
18+ local helpMessage
19+
20+ briefMessage=" Run bash linter"
21+ helpMessage=$( cat << EOF
22+ Run shellckheck test over the following scripts:
23+
24+ * *.sh
25+ * devcontrol/actions/*.sh
26+ * devcontrol/global/*.sh
27+ EOF
28+ )
29+
30+ # Task choosing
31+ case $1 in
32+ brief)
33+ showBriefMessage " ${FUNCNAME[0]} " " $briefMessage "
34+ ;;
35+ help)
36+ showHelpMessage " ${FUNCNAME[0]} " " $helpMessage "
37+ ;;
38+ exec)
39+ exitCode=0
40+ for file in * .sh devcontrol/actions/* .sh devcontrol/global/* .sh; do
41+ echo -n " Running shellcheck bash linter over ${file} ..."
42+ failed=0
43+ docker run --network none -i --rm --workdir /workspace -v " $( pwd) " :/workspace koalaman/shellcheck-alpine shellcheck -x " ${file} " -e 2206|| failed=1
44+ if [ ${failed} -eq 0 ]; then
45+ echo " [OK]"
46+ else
47+ echo " -----> Test failed"
48+ exitCode=$(( exitCode + 1 ))
49+ fi
50+ done
51+ exit ${exitCode}
52+ ;;
53+ * )
54+ showNotImplemtedMessage " $1 " " ${FUNCNAME[0]} "
55+ return 1
56+ esac
57+ }
58+
59+ # Main
60+ run-bash-linter " $@ "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -eu
4+
5+ # @file devcontrol/global/startup.sh
6+ # @brief devcontrol startup script and functions
7+ echo " Docker Command Launcher - Markdown to HTML converter"
8+ echo
9+
You can’t perform that action at this time.
0 commit comments