From 3c4c9131aab16d1c9adf46b7a09d454231ced769 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Fri, 17 Aug 2018 21:21:41 -0400 Subject: [PATCH] Jenkins add ShellCheck --- Jenkinsfile | 15 +++++++++++++++ Makefile | 3 +++ Tools/run-shellcheck.sh | 7 ++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f4adf8c56b..a4402087e9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -160,6 +160,21 @@ pipeline { } } + stage('ShellCheck') { + agent { + docker { + image 'px4io/px4-dev-base:2018-08-23' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'make shellcheck' + sh 'make distclean' + } + } + } // parallel } // stage Analysis diff --git a/Makefile b/Makefile index f682c4f2ad..35c28712db 100644 --- a/Makefile +++ b/Makefile @@ -360,6 +360,9 @@ cppcheck: posix_sitl_default @cppcheck -i$(SRC_DIR)/src/examples --enable=performance --std=c++11 --std=c99 --std=posix --project=$(SRC_DIR)/build/posix_sitl_default/compile_commands.json --xml-version=2 2> $(SRC_DIR)/build/cppcheck/cppcheck-result.xml > /dev/null @cppcheck-htmlreport --source-encoding=ascii --file=$(SRC_DIR)/build/cppcheck/cppcheck-result.xml --report-dir=$(SRC_DIR)/build/cppcheck --source-dir=$(SRC_DIR)/src/ +shellcheck: + @$(SRC_DIR)/Tools/run-shellcheck.sh $(SRC_DIR)/ROMFS/px4fmu_common/ + # Cleanup # -------------------------------------------------------------------- .PHONY: clean submodulesclean submodulesupdate gazeboclean distclean diff --git a/Tools/run-shellcheck.sh b/Tools/run-shellcheck.sh index 44640cf5a5..c5760abefb 100755 --- a/Tools/run-shellcheck.sh +++ b/Tools/run-shellcheck.sh @@ -24,7 +24,12 @@ echo "Running shellcheck in '$search_directory'." # SC2086: double quote to prevent globbing and word splitting # SC2166: allow the form [ $OUTPUT_MODE == fmu -o $OUTPUT_MODE == io ] # SC2148: allow files w/o shebang -shellcheck -a -x -e SC2121 -e SC1008 -e SC2086 -e SC2166 -e SC2148 \ +shellcheck -x \ + -e SC1008 \ + -e SC2086 \ + -e SC2121 \ + -e SC2148 \ + -e SC2166 \ $scripts ret=$? if [ $ret -ne 0 ]; then