Skip to content
Snippets Groups Projects
Commit 577a1088 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- fixed shellcheck warnings

parent 5ee8d668
Branches
No related tags found
No related merge requests found
...@@ -103,8 +103,8 @@ set -o nounset # Treat unset variables as an error ...@@ -103,8 +103,8 @@ set -o nounset # Treat unset variables as an error
set -e set -e
check_argument_count() { check_argument_count() {
local count=$1 local count="$1"
local expected=$2 local expected="$2"
if [ "${count}" -ne "${expected}" ]; then 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]})" error "called function ${FUNCNAME[1]} expected ${expected} params, but got ${count} by caller function ${FUNCNAME[2]} (line ${BASH_LINENO[2]})"
exit 1 exit 1
...@@ -112,7 +112,7 @@ check_argument_count() { ...@@ -112,7 +112,7 @@ check_argument_count() {
} }
check_argument_notempty() { check_argument_notempty() {
local param=$1 local param="$1"
if [ -z "${param}" ]; then 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]})" 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 exit 1
...@@ -148,11 +148,11 @@ print_statistics() { ...@@ -148,11 +148,11 @@ print_statistics() {
update_statistics() { update_statistics() {
check_argument_count $# 5 check_argument_count $# 5
local is_valid=$1 local is_valid="$1"
local duration=$2 local duration="$2"
local ftype=$3 local ftype="$3"
local workflow=$4 local workflow="$4"
local stage=$5 local stage="$5"
check_argument_notempty "${is_valid}" check_argument_notempty "${is_valid}"
check_argument_notempty "${duration}" check_argument_notempty "${duration}"
check_argument_notempty "${ftype}" check_argument_notempty "${ftype}"
...@@ -187,7 +187,7 @@ error() { ...@@ -187,7 +187,7 @@ error() {
get_mimetype() { get_mimetype() {
check_argument_count $# 1 check_argument_count $# 1
local filename=$1 local filename="$1"
check_argument_notempty "${filename}" check_argument_notempty "${filename}"
local res local res
res=$(file --mime-type "${filename}" | sed -e "s/^.*: //") res=$(file --mime-type "${filename}" | sed -e "s/^.*: //")
...@@ -332,9 +332,9 @@ get_cli_args() { ...@@ -332,9 +332,9 @@ get_cli_args() {
prepare_cmd() { prepare_cmd() {
check_argument_count $# 3 check_argument_count $# 3
local mode=$1 local mode="$1"
local ftype=$2 local ftype="$2"
local stage=$3 local stage="$3"
check_argument_notempty "${mode}" check_argument_notempty "${mode}"
check_argument_notempty "${ftype}" check_argument_notempty "${ftype}"
check_argument_notempty "${stage}" check_argument_notempty "${stage}"
...@@ -356,7 +356,7 @@ prepare_cmd() { ...@@ -356,7 +356,7 @@ prepare_cmd() {
prepare_ftype() { prepare_ftype() {
check_argument_count $# 1 check_argument_count $# 1
local mimetype=$1 local mimetype="$1"
check_argument_notempty "${mimetype}" check_argument_notempty "${mimetype}"
local ftype local ftype
debug "prepare_ftype, using mimetype: ${mimetype}" debug "prepare_ftype, using mimetype: ${mimetype}"
...@@ -382,7 +382,7 @@ prepare_ftype() { ...@@ -382,7 +382,7 @@ prepare_ftype() {
estimate_mode() { estimate_mode() {
check_argument_count $# 1 check_argument_count $# 1
local mimetype=$1 local mimetype="$1"
check_argument_notempty "${mimetype}" check_argument_notempty "${mimetype}"
debug "estimate_mode, using mimetype: ${mimetype}" debug "estimate_mode, using mimetype: ${mimetype}"
case ${mimetype} in case ${mimetype} in
...@@ -407,11 +407,11 @@ estimate_mode() { ...@@ -407,11 +407,11 @@ estimate_mode() {
exec_cmd() { exec_cmd() {
check_argument_count $# 5 check_argument_count $# 5
local cmd=$1 local cmd="$1"
local ftype=$2 local ftype="$2"
local workflow=$3 local workflow="$3"
local stage=$4 local stage="$4"
local log=$5 local log="$5"
local start_t local start_t
local stop_t local stop_t
check_argument_notempty "${cmd}" check_argument_notempty "${cmd}"
...@@ -433,8 +433,8 @@ exec_cmd() { ...@@ -433,8 +433,8 @@ exec_cmd() {
handle_input_if_requested() { handle_input_if_requested() {
check_argument_count $# 2 check_argument_count $# 2
local filename=$1 local filename="$1"
local is_valid=$2 local is_valid="$2"
check_argument_notempty "${filename}" check_argument_notempty "${filename}"
check_argument_notempty "${is_valid}" check_argument_notempty "${is_valid}"
debug "handle_input_if_requested, filename=${filename} is_valid=${is_valid}" debug "handle_input_if_requested, filename=${filename} is_valid=${is_valid}"
...@@ -454,7 +454,7 @@ handle_input_if_requested() { ...@@ -454,7 +454,7 @@ handle_input_if_requested() {
get_logfile() { get_logfile() {
check_argument_count $# 1 check_argument_count $# 1
local filename=$1 local filename="$1"
local logname local logname
check_argument_notempty "${filename}" check_argument_notempty "${filename}"
if [ -n "${WATCH_FOLDER}" ] && [ "${WITH_PIPE}" -eq 0 ]; then if [ -n "${WATCH_FOLDER}" ] && [ "${WITH_PIPE}" -eq 0 ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment