From 577a1088c3c92a69861bbdfa73ad4c75df05f9f5 Mon Sep 17 00:00:00 2001
From: Andreas Romeyke <andreas.romeyke@slub-dresden.de>
Date: Tue, 21 Feb 2023 17:34:42 +0100
Subject: [PATCH] - fixed shellcheck warnings

---
 validate_workflow.sh | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/validate_workflow.sh b/validate_workflow.sh
index 98eb9b4..608d5e4 100755
--- a/validate_workflow.sh
+++ b/validate_workflow.sh
@@ -103,8 +103,8 @@ set -o nounset                              # Treat unset variables as an error
 set -e
 
 check_argument_count() {
-    local count=$1
-    local expected=$2
+    local count="$1"
+    local expected="$2"
     if [ "${count}" -ne "${expected}" ]; then
         error "called function ${FUNCNAME[1]} expected ${expected} params, but got ${count} by caller function ${FUNCNAME[2]} (line ${BASH_LINENO[2]})"
         exit 1
@@ -112,7 +112,7 @@ check_argument_count() {
 }
 
 check_argument_notempty() {
-    local param=$1
+    local param="$1"
     if [ -z "${param}" ]; then
         error "called function ${FUNCNAME[1]} expected non-empty params, but some are empty set in line ${BASH_LINENO[0]}, eventually taken from caller function ${FUNCNAME[1]} (line ${BASH_LINENO[1]})"
         exit 1
@@ -148,11 +148,11 @@ print_statistics() {
 
 update_statistics() {
     check_argument_count $# 5
-    local is_valid=$1
-    local duration=$2
-    local ftype=$3
-    local workflow=$4
-    local stage=$5
+    local is_valid="$1"
+    local duration="$2"
+    local ftype="$3"
+    local workflow="$4"
+    local stage="$5"
     check_argument_notempty "${is_valid}"
     check_argument_notempty "${duration}"
     check_argument_notempty "${ftype}"
@@ -187,7 +187,7 @@ error() {
 
 get_mimetype() {
     check_argument_count $# 1
-    local filename=$1
+    local filename="$1"
     check_argument_notempty "${filename}"
     local res
     res=$(file --mime-type "${filename}" |  sed -e "s/^.*: //")
@@ -332,9 +332,9 @@ get_cli_args() {
 
 prepare_cmd() {
     check_argument_count $# 3
-    local mode=$1
-    local ftype=$2
-    local stage=$3
+    local mode="$1"
+    local ftype="$2"
+    local stage="$3"
     check_argument_notempty "${mode}"
     check_argument_notempty "${ftype}"
     check_argument_notempty "${stage}"
@@ -356,7 +356,7 @@ prepare_cmd() {
 
 prepare_ftype() {
     check_argument_count $# 1
-    local mimetype=$1
+    local mimetype="$1"
     check_argument_notempty "${mimetype}"
     local ftype
     debug "prepare_ftype, using mimetype: ${mimetype}"
@@ -382,7 +382,7 @@ prepare_ftype() {
 
 estimate_mode() {
     check_argument_count $# 1
-    local mimetype=$1
+    local mimetype="$1"
     check_argument_notempty "${mimetype}"
     debug "estimate_mode, using mimetype: ${mimetype}"
     case ${mimetype} in
@@ -407,11 +407,11 @@ estimate_mode() {
 
 exec_cmd() {
     check_argument_count $# 5
-    local cmd=$1
-    local ftype=$2
-    local workflow=$3
-    local stage=$4
-    local log=$5
+    local cmd="$1"
+    local ftype="$2"
+    local workflow="$3"
+    local stage="$4"
+    local log="$5"
     local start_t
     local stop_t
     check_argument_notempty "${cmd}"
@@ -433,8 +433,8 @@ exec_cmd() {
 
 handle_input_if_requested() {
     check_argument_count $# 2
-    local filename=$1
-    local is_valid=$2
+    local filename="$1"
+    local is_valid="$2"
     check_argument_notempty "${filename}"
     check_argument_notempty "${is_valid}"
     debug "handle_input_if_requested, filename=${filename} is_valid=${is_valid}"
@@ -454,7 +454,7 @@ handle_input_if_requested() {
 
 get_logfile() {
     check_argument_count $# 1
-    local filename=$1
+    local filename="$1"
     local logname
     check_argument_notempty "${filename}"
     if [ -n "${WATCH_FOLDER}" ] && [ "${WITH_PIPE}" -eq 0 ]; then
-- 
GitLab