From 67b796c8cbba0c851154cca7564b8dee99f49fa5 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Sat, 19 Jun 2021 14:12:37 -0500 Subject: [PATCH] Clean up shellcheck warnings --- rowbot | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/rowbot b/rowbot index 0771ce2..36ca481 100755 --- a/rowbot +++ b/rowbot @@ -78,6 +78,8 @@ if [[ $tls = yes ]]; then exit 1 fi + # false positive + # shellcheck disable=SC2102 if [[ -v opts[client-cert] ]]; then client_cert=${opts[client-cert]} fi @@ -206,6 +208,8 @@ fi send() { local fmt + # As this is a printf wrapper, the format string is provided as an argument + # shellcheck disable=SC2059 printf -v fmt "$1" "${@:2}" printf '%s\r\n' "$fmt" >&"$out_sock" debug "sending line: %s" "$fmt" @@ -240,7 +244,7 @@ on_MODE() { } on_NICK() { - if [[ $from = $nick ]]; then + if [[ $from = "$nick" ]]; then nick=${params[0]} fi @@ -316,7 +320,12 @@ on_005() { local param key value for param in "${params[@]:1:${#params[@]}-2}"; do + # This is a valid assignment, not a comparison + # shellcheck disable=SC1097 IFS== read -r key value <<< "$param" + # While isupport is unused, it's still there in case later code wants to + # use it + # shellcheck disable=SC2034 isupport[$key]=$value debug "isupport: %s = %s" "$key" "$value" done @@ -373,7 +382,7 @@ on_353() { } on_354() { - if (( ${params[1]} == 42 )); then + if (( params[1] == 42 )); then debug "received the identifying who" ident=${params[2]} host=${params[3]} debug "ident=%s host=%s" "$ident" "$host" @@ -583,7 +592,8 @@ hook_post_PRIVMSG_factoids() { local key=${words[0]:${#trigger}} if [[ -f $fact_root/${params[0]}/$key ]]; then - local msg=$(<"$fact_root"/"${params[0]}"/"$key") + local msg + msg=$(<"$fact_root"/"${params[0]}"/"$key") if (( ${#words[@]} > 1 )) && [[ ${words[1]} = \> ]]; then local target @@ -599,7 +609,7 @@ hook_post_PRIVMSG_factoids() { hook_post_PRIVMSG_control_panel() { if [[ ${words[0]} = "$trigger"* ]]; then - if [[ $from != $owner && $dev != yes ]]; then + if [[ $from != "$owner" && $dev != yes ]]; then return 0 fi @@ -695,7 +705,7 @@ hook_post_433_alternick() { } hook_post_NICK_alternick() { - if [[ ${params[0]} = $desired_nick ]]; then + if [[ ${params[0]} = "$desired_nick" ]]; then keep_trying=no info "obtained nick %s" "$desired_nick" fi