Browse Source

automatic shellchecking on .sh.in scripts (#5165)

* CI linting .sh.in files

* make linter passing
Paweł Krupa 6 years ago
parent
commit
06a367d876

+ 2 - 0
.travis.yml

@@ -21,6 +21,8 @@ jobs:
     env: CFLAGS='-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1'
   - name: dashboard.js
     script: cp web/gui/dashboard.js /tmp/dashboard.js && ./build/build.sh && diff /tmp/dashboard.js web/gui/dashboard.js
+  - name: lint .sh.in files
+    script: shellcheck --format=gcc $(find . -name '*.sh.in' -not -iwholename '*.git*')
   - name: coverity
     install: sudo apt-get install -y zlib1g-dev uuid-dev libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev
     script: ./coverity-scan.sh || echo "Coverity failed :("

+ 1 - 0
collectors/tc.plugin/tc-qos-helper.sh.in

@@ -216,6 +216,7 @@ show_fireqos_names() {
 		#shellcheck source=/dev/null
 		source "${fireqos_run_dir}/${name}.conf"
 		for n in ${interface_classes_monitor}; do
+			# shellcheck disable=SC2086
 			setclassname ${n//|/ }
 		done
 		[ -n "${interface_dev}" ] && echo "SETDEVICEGROUP ${interface_dev}"

+ 3 - 2
health/notifications/alarm-notify.sh.in

@@ -111,7 +111,7 @@ debug() {
 
 docurl() {
 	if [ -z "${curl}" ]; then
-		error '${curl} is unset.'
+		error "${curl} is unset."
 		return 1
 	fi
 
@@ -216,7 +216,8 @@ else
 	units="${17}"              # the units of the value
 	info="${18}"               # a short description of the alarm
 	value_string="${19}"       # friendly value (with units)
-	# shellcheck disable=SC2034 variable is unused, but https://github.com/netdata/netdata/pull/5164#discussion_r255572947
+	# shellcheck disable=SC2034
+	# variable is unused, but https://github.com/netdata/netdata/pull/5164#discussion_r255572947
 	old_value_string="${20}"   # friendly old value (with units), previously named "old_value_string"
 	calc_expression="${21}"    # contains the expression that was evaluated to trigger the alarm
 	calc_param_values="${22}"  # the values of the parameters in the expression, at the time of the evaluation

+ 2 - 1
tests/health_mgmtapi/health-cmdapi-test.sh.in

@@ -1,4 +1,5 @@
 #!/usr/bin/env bash
+# shellcheck disable=SC1117,SC2034,SC2059,SC2086,SC2181
 
 NETDATA_USER_CONFIG_DIR="@configdir_POST@"
 NETDATA_STOCK_CONFIG_DIR="@libconfigdir_POST@"
@@ -260,4 +261,4 @@ fi
 if [ $err -gt 0 ] ; then
 	echo "$err error(s) found"
 	exit 1
-fi
+fi