@@ -114,7 +114,8 @@ ulimit -t 600
114114umask 137
115115
116116# force utf-8 for checking in script
117- export LC_CTYPE=" ${LC_CTYPE:- en_US.UTF-8} "
117+ LC_CTYPE=" ${LC_CTYPE:- en_US.UTF-8} "
118+ export LC_CTYPE
118119# set remaining variables
119120LOCK_FILE=" ${TMPDIR:-/ tmp} /org.pak.multicast.pip-check-shell"
120121# Global variable to track temporary directories
@@ -138,6 +139,7 @@ function check_command() {
138139 " ${SCRIPT_FILE} " " ${BASH_LINENO:- 0} " \
139140 " Error: command name is required to check for existence." >&2 ; exit 64 ; } ;
140141 local cmd=" $1 " ;
142+ # shellcheck disable=SC2086
141143 test -x " $( command -v ${cmd} ) " || { printf " ::error file=%s,line=%s,title=COMMAND::%s\n" \
142144 " ${SCRIPT_FILE} " " ${BASH_LINENO:- 0} " \
143145 " Error: Required command '$cmd ' is not found." >&2 ; exit 126 ; } ;
@@ -149,13 +151,16 @@ export -f check_command
149151hash -p ./.github/tool_shlock_helper.sh shlock || { printf " %s\n" " Error: Failed to register shlock helper. CEP-5 locking will not work." >&2 ; exit 78 ; } ;
150152
151153# Check required commands
152- check_required_commands () {
154+ function check_required_commands() {
153155 local -ra REQUIRED_COMMANDS=(" grep" " python3" " git" " mktemp" " sed" " tee" " tr" " cut" " pip" )
154156 local cmd
155157 for cmd in " ${REQUIRED_COMMANDS[@]} " ; do
156158 check_command " ${cmd} "
157159 done
158160}
161+
162+ check_required_commands
163+
159164if command -v pip-audit > /dev/null 2>&1 ; then
160165 check_command pip-audit # optional
161166else
@@ -203,7 +208,8 @@ function handle_signals() {
203208 trap ' cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 129 ;' SIGHUP || EXIT_CODE=129
204209 trap ' cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 143 ;' SIGTERM || EXIT_CODE=143
205210 trap ' cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 131 ;' SIGQUIT || EXIT_CODE=131
206- # shellcheck disable=SC2173 - https://github.com/koalaman/shellcheck/wiki/SC2173
211+ # SC2173 - https://github.com/koalaman/shellcheck/wiki/SC2173
212+ # shellcheck disable=SC2173
207213 # trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
208214 trap ' cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 130 ;' SIGINT || EXIT_CODE=130
209215 trap ' cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 137 ;' SIGABRT || EXIT_CODE=137
@@ -292,6 +298,7 @@ function get_package_list() {
292298
293299function install_package() {
294300 local pkg=" $1 "
301+ # shellcheck disable=SC2086
295302 if ! python3 -m pip install $PIP_COMMON_FLAGS $PIP_ENV_FLAGS " ${pkg} " ; then
296303 printf " ::warning file=%s,title=PIP::Failed to install %s\n" " ${req_file} " " ${pkg} " >&2 ;
297304 return 6
@@ -381,7 +388,7 @@ if [[ ("${EXIT_CODE}" -eq 0) ]] ; then
381388
382389 printf " ::debug::%s\n" " Reading from repository ${_TEST_ROOT_DIR} ..." ;
383390 # Get a list of files to check using git ls-tree with filtering (and careful shell globing)
384- FILES_TO_CHECK=$( git ls-tree -r --full-tree --name-only HEAD -- " ${_TEST_ROOT_DIR} " /test/requirements.txt " ${_TEST_ROOT_DIR} " /* -requirements.txt " ${_TEST_ROOT_DIR} /requirements.txt" 2> /dev/null || EXIT_CODE=3)
391+ FILES_TO_CHECK=$( git ls-tree -r --full-tree --name-only HEAD -- " ${_TEST_ROOT_DIR} " /test/requirements.txt " ${_TEST_ROOT_DIR} " /* -requirements.txt " ${_TEST_ROOT_DIR} /requirements.txt" 2> /dev/null) || EXIT_CODE=3 ;
385392 [[ ( $EXIT_CODE -eq 0 ) ]] || { printf " %s\n" " ::error file=${SCRIPT_FILE} ,line=${BASH_LINENO:- 0} ,title=GIT::Failed to list requirements files using git ls-tree" >&2 ; }
386393
387394 if [[ (" ${EXIT_CODE} " -eq 0) ]] ; then
0 commit comments