Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localifs #714

Merged
merged 4 commits into from
Feb 14, 2025
Merged

Localifs #714

merged 4 commits into from
Feb 14, 2025

Conversation

gsmith-sas
Copy link
Member

No description provided.

Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck -e SC1004' returned error 1 finding the following syntactical issues:

----------

In bin/log-include.sh line 1:
# Copyright © 2021, SAS Institute Inc., Cary, NC, USA.  All Rights Reserved.
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In bin/log-include.sh line 34:
  echo $* >> $TMP_DIR/notices.txt
       ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.
       ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
             ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  echo "$*" >> "$TMP_DIR"/notices.txt


In bin/log-include.sh line 40:
     cat $TMP_DIR/notices.txt | while read line || [[ -n "$line" ]];
         ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                      ^--^ SC2162 (info): read without -r will mangle backslashes.

Did you mean: 
     cat "$TMP_DIR"/notices.txt | while read line || [[ -n "$line" ]];


In bin/log-include.sh line 49:
  n=$(($width - $(echo "$1" | wc -c)))
       ^----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.
                  ^---------------^ SC2000 (style): See if you can use ${#variable} instead.


In bin/log-include.sh line 54:
  text="$*$(printf %$(eval 'echo $n')s |tr ' ' ' ')"
                    ^---------------^ SC2046 (warning): Quote this to prevent word splitting.


In bin/log-include.sh line 57:
    whiteb "${bluebg}$text"
            ^-------^ SC2154 (warning): bluebg is referenced but not assigned.


In bin/log-include.sh line 75:
        echo -e "${whiteb}${level}${white}$*${end}" >&3
                 ^-------^ SC2154 (warning): whiteb is referenced but not assigned.
                                  ^------^ SC2154 (warning): white is referenced but not assigned.
                                            ^----^ SC2154 (warning): end is referenced but not assigned.


In bin/log-include.sh line 89:
    echo -e "${greenb}${level}${whiteb}$*${end}" >&3
             ^-------^ SC2154 (warning): greenb is referenced but not assigned.


In bin/log-include.sh line 99:
		log_info $* >&3
                         ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.
                         ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
		log_info "$*" >&3


In bin/log-include.sh line 110:
    echo -e "${black}${yellowbg}${level}$*${end}" >&3
             ^------^ SC2154 (warning): black is referenced but not assigned.
                     ^---------^ SC2154 (warning): yellowbg is referenced but not assigned.


In bin/log-include.sh line 123:
    echo -e "${whiteb}${redbg}${level}$*${end}" >&3
                      ^------^ SC2154 (warning): redbg is referenced but not assigned.

For more information:
  https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2048 -- Use "$@" (with quotes) to prevent...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt -s' returned error 1 finding the following formatting issues:

----------
diff bin/log-include.sh.orig bin/log-include.sh
--- bin/log-include.sh.orig
+++ bin/log-include.sh
@@ -10,120 +10,119 @@
 
 # This must be run without 'set -e' being set
 # So it has to be done up here and not within log_notice
-if [ -z "$TERM" ] || ! tput cols >/dev/null 2>&1 ; then
-  # Non-interactive shell
-  LOG_COLOR_ENABLE=false
-  noticeColWidth=${LOG_NOTICE_COL_WIDTH:-100}
+if [ -z "$TERM" ] || ! tput cols >/dev/null 2>&1; then
+	# Non-interactive shell
+	LOG_COLOR_ENABLE=false
+	noticeColWidth=${LOG_NOTICE_COL_WIDTH:-100}
 else
-  # Terminal width should be accessible
-  noticeColWidth=${LOG_NOTICE_COL_WIDTH:-$(tput cols)}
-  if [ "$noticeColWidth" == "" ]; then
-    noticeColWidth=100
-  fi
+	# Terminal width should be accessible
+	noticeColWidth=${LOG_NOTICE_COL_WIDTH:-$(tput cols)}
+	if [ "$noticeColWidth" == "" ]; then
+		noticeColWidth=100
+	fi
 fi
 
 if [ "$LOG_VERBOSE_ENABLE" != "true" ]; then
-  # Send stdout to /dev/null
-  # All non-error command output (kubectl, helm, etc.) will be suppressed
-  # for non-verbose mode. log_* calls will funtion normally since they are
-  # sent to &3, which is a copy of stdout
-  exec 1>/dev/null
+	# Send stdout to /dev/null
+	# All non-error command output (kubectl, helm, etc.) will be suppressed
+	# for non-verbose mode. log_* calls will funtion normally since they are
+	# sent to &3, which is a copy of stdout
+	exec 1>/dev/null
 fi
 
 function add_notice {
-  echo $* >> $TMP_DIR/notices.txt
+	echo $* >>$TMP_DIR/notices.txt
 }
 
 function display_notices {
-  if [ -f "$TMP_DIR/notices.txt" ]; then
-     local IFS=''
-     cat $TMP_DIR/notices.txt | while read line || [[ -n "$line" ]];
-     do
-       log_notice "$line"
-     done
- fi
+	if [ -f "$TMP_DIR/notices.txt" ]; then
+		local IFS=''
+		cat $TMP_DIR/notices.txt | while read line || [[ -n $line ]]; do
+			log_notice "$line"
+		done
+	fi
 }
 
 function log_notice {
-  width=$noticeColWidth
-  n=$(($width - $(echo "$1" | wc -c)))
-  if [ $n -lt 0 ]; then
-     n=0
-  fi
-  # Fill remaining characters with spaces
-  text="$*$(printf %$(eval 'echo $n')s |tr ' ' ' ')"
-
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    whiteb "${bluebg}$text"
-  else
-    echo "$text" >&3
-  fi
+	width=$noticeColWidth
+	n=$((width - $(echo "$1" | wc -c)))
+	if [ $n -lt 0 ]; then
+		n=0
+	fi
+	# Fill remaining characters with spaces
+	text="$*$(printf %$(eval 'echo $n')s | tr ' ' ' ')"
+
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		whiteb "${bluebg}$text"
+	else
+		echo "$text" >&3
+	fi
 }
 
 function log_message {
-    echo "$*"  >&3
+	echo "$*" >&3
 }
 
 function log_debug {
-  if [ "$LOG_DEBUG_ENABLE" = "true" ]; then
-    if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-        level="DEBUG "
-    else
-        level=""
-    fi
-    if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-        echo -e "${whiteb}${level}${white}$*${end}" >&3
-    else
-        echo "${level}$*" >&3
-    fi
-  fi
+	if [ "$LOG_DEBUG_ENABLE" = "true" ]; then
+		if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+			level="DEBUG "
+		else
+			level=""
+		fi
+		if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+			echo -e "${whiteb}${level}${white}$*${end}" >&3
+		else
+			echo "${level}$*" >&3
+		fi
+	fi
 }
 
 function log_info {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="INFO "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${greenb}${level}${whiteb}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="INFO "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${greenb}${level}${whiteb}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 # Verbose messages are basically optional, more detailed INFO messages
 # The value of LOG_VERBOSE_ENABLE determines whether they are displayed
 function log_verbose {
-  if [ "$LOG_VERBOSE_ENABLE" == "true" ]; then
+	if [ "$LOG_VERBOSE_ENABLE" == "true" ]; then
 		log_info $* >&3
-  fi
+	fi
 }
 
 function log_warn {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="WARN "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${black}${yellowbg}${level}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="WARN "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${black}${yellowbg}${level}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 function log_error {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="ERROR "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${whiteb}${redbg}${level}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="ERROR "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${whiteb}${redbg}${level}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 export -f log_notice log_message log_debug log_info log_warn log_error add_notice display_notices log_verbose
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt -s -w filename


@gsmith-sas gsmith-sas requested a review from ceelias February 13, 2025 15:46
Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck -e SC1004' returned error 1 finding the following syntactical issues:

----------

In bin/log-include.sh line 1:
# Copyright © 2021, SAS Institute Inc., Cary, NC, USA.  All Rights Reserved.
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In bin/log-include.sh line 34:
  echo $* >> $TMP_DIR/notices.txt
       ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.
       ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
             ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  echo "$*" >> "$TMP_DIR"/notices.txt


In bin/log-include.sh line 40:
     cat $TMP_DIR/notices.txt | while read line || [[ -n "$line" ]];
         ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                      ^--^ SC2162 (info): read without -r will mangle backslashes.

Did you mean: 
     cat "$TMP_DIR"/notices.txt | while read line || [[ -n "$line" ]];


In bin/log-include.sh line 49:
  n=$(($width - $(echo "$1" | wc -c)))
       ^----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.
                  ^---------------^ SC2000 (style): See if you can use ${#variable} instead.


In bin/log-include.sh line 54:
  text="$*$(printf %$(eval 'echo $n')s |tr ' ' ' ')"
                    ^---------------^ SC2046 (warning): Quote this to prevent word splitting.


In bin/log-include.sh line 57:
    whiteb "${bluebg}$text"
            ^-------^ SC2154 (warning): bluebg is referenced but not assigned.


In bin/log-include.sh line 75:
        echo -e "${whiteb}${level}${white}$*${end}" >&3
                 ^-------^ SC2154 (warning): whiteb is referenced but not assigned.
                                  ^------^ SC2154 (warning): white is referenced but not assigned.
                                            ^----^ SC2154 (warning): end is referenced but not assigned.


In bin/log-include.sh line 89:
    echo -e "${greenb}${level}${whiteb}$*${end}" >&3
             ^-------^ SC2154 (warning): greenb is referenced but not assigned.


In bin/log-include.sh line 99:
		log_info $* >&3
                         ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.
                         ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
		log_info "$*" >&3


In bin/log-include.sh line 110:
    echo -e "${black}${yellowbg}${level}$*${end}" >&3
             ^------^ SC2154 (warning): black is referenced but not assigned.
                     ^---------^ SC2154 (warning): yellowbg is referenced but not assigned.


In bin/log-include.sh line 123:
    echo -e "${whiteb}${redbg}${level}$*${end}" >&3
                      ^------^ SC2154 (warning): redbg is referenced but not assigned.

For more information:
  https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2048 -- Use "$@" (with quotes) to prevent...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt -s' returned error 1 finding the following formatting issues:

----------
diff bin/log-include.sh.orig bin/log-include.sh
--- bin/log-include.sh.orig
+++ bin/log-include.sh
@@ -10,120 +10,119 @@
 
 # This must be run without 'set -e' being set
 # So it has to be done up here and not within log_notice
-if [ -z "$TERM" ] || ! tput cols >/dev/null 2>&1 ; then
-  # Non-interactive shell
-  LOG_COLOR_ENABLE=false
-  noticeColWidth=${LOG_NOTICE_COL_WIDTH:-100}
+if [ -z "$TERM" ] || ! tput cols >/dev/null 2>&1; then
+	# Non-interactive shell
+	LOG_COLOR_ENABLE=false
+	noticeColWidth=${LOG_NOTICE_COL_WIDTH:-100}
 else
-  # Terminal width should be accessible
-  noticeColWidth=${LOG_NOTICE_COL_WIDTH:-$(tput cols)}
-  if [ "$noticeColWidth" == "" ]; then
-    noticeColWidth=100
-  fi
+	# Terminal width should be accessible
+	noticeColWidth=${LOG_NOTICE_COL_WIDTH:-$(tput cols)}
+	if [ "$noticeColWidth" == "" ]; then
+		noticeColWidth=100
+	fi
 fi
 
 if [ "$LOG_VERBOSE_ENABLE" != "true" ]; then
-  # Send stdout to /dev/null
-  # All non-error command output (kubectl, helm, etc.) will be suppressed
-  # for non-verbose mode. log_* calls will funtion normally since they are
-  # sent to &3, which is a copy of stdout
-  exec 1>/dev/null
+	# Send stdout to /dev/null
+	# All non-error command output (kubectl, helm, etc.) will be suppressed
+	# for non-verbose mode. log_* calls will funtion normally since they are
+	# sent to &3, which is a copy of stdout
+	exec 1>/dev/null
 fi
 
 function add_notice {
-  echo $* >> $TMP_DIR/notices.txt
+	echo $* >>$TMP_DIR/notices.txt
 }
 
 function display_notices {
-  if [ -f "$TMP_DIR/notices.txt" ]; then
-     local IFS=''
-     cat $TMP_DIR/notices.txt | while read line || [[ -n "$line" ]];
-     do
-       log_notice "$line"
-     done
- fi
+	if [ -f "$TMP_DIR/notices.txt" ]; then
+		local IFS=''
+		cat $TMP_DIR/notices.txt | while read line || [[ -n $line ]]; do
+			log_notice "$line"
+		done
+	fi
 }
 
 function log_notice {
-  width=$noticeColWidth
-  n=$(($width - $(echo "$1" | wc -c)))
-  if [ $n -lt 0 ]; then
-     n=0
-  fi
-  # Fill remaining characters with spaces
-  text="$*$(printf %$(eval 'echo $n')s |tr ' ' ' ')"
-
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    whiteb "${bluebg}$text"
-  else
-    echo "$text" >&3
-  fi
+	width=$noticeColWidth
+	n=$((width - $(echo "$1" | wc -c)))
+	if [ $n -lt 0 ]; then
+		n=0
+	fi
+	# Fill remaining characters with spaces
+	text="$*$(printf %$(eval 'echo $n')s | tr ' ' ' ')"
+
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		whiteb "${bluebg}$text"
+	else
+		echo "$text" >&3
+	fi
 }
 
 function log_message {
-    echo "$*"  >&3
+	echo "$*" >&3
 }
 
 function log_debug {
-  if [ "$LOG_DEBUG_ENABLE" = "true" ]; then
-    if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-        level="DEBUG "
-    else
-        level=""
-    fi
-    if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-        echo -e "${whiteb}${level}${white}$*${end}" >&3
-    else
-        echo "${level}$*" >&3
-    fi
-  fi
+	if [ "$LOG_DEBUG_ENABLE" = "true" ]; then
+		if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+			level="DEBUG "
+		else
+			level=""
+		fi
+		if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+			echo -e "${whiteb}${level}${white}$*${end}" >&3
+		else
+			echo "${level}$*" >&3
+		fi
+	fi
 }
 
 function log_info {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="INFO "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${greenb}${level}${whiteb}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="INFO "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${greenb}${level}${whiteb}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 # Verbose messages are basically optional, more detailed INFO messages
 # The value of LOG_VERBOSE_ENABLE determines whether they are displayed
 function log_verbose {
-  if [ "$LOG_VERBOSE_ENABLE" == "true" ]; then
+	if [ "$LOG_VERBOSE_ENABLE" == "true" ]; then
 		log_info $* >&3
-  fi
+	fi
 }
 
 function log_warn {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="WARN "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${black}${yellowbg}${level}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="WARN "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${black}${yellowbg}${level}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 function log_error {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="ERROR "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${whiteb}${redbg}${level}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="ERROR "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${whiteb}${redbg}${level}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 export -f log_notice log_message log_debug log_info log_warn log_error add_notice display_notices log_verbose
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt -s -w filename


Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck -e SC1004' returned error 1 finding the following syntactical issues:

----------

In bin/log-include.sh line 1:
# Copyright © 2021, SAS Institute Inc., Cary, NC, USA.  All Rights Reserved.
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In bin/log-include.sh line 34:
  echo $* >> $TMP_DIR/notices.txt
       ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.
       ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
             ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  echo "$*" >> "$TMP_DIR"/notices.txt


In bin/log-include.sh line 40:
     cat $TMP_DIR/notices.txt | while read line || [[ -n "$line" ]];
         ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                      ^--^ SC2162 (info): read without -r will mangle backslashes.

Did you mean: 
     cat "$TMP_DIR"/notices.txt | while read line || [[ -n "$line" ]];


In bin/log-include.sh line 49:
  n=$(($width - $(echo "$1" | wc -c)))
       ^----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.
                  ^---------------^ SC2000 (style): See if you can use ${#variable} instead.


In bin/log-include.sh line 54:
  text="$*$(printf %$(eval 'echo $n')s |tr ' ' ' ')"
                    ^---------------^ SC2046 (warning): Quote this to prevent word splitting.


In bin/log-include.sh line 57:
    whiteb "${bluebg}$text"
            ^-------^ SC2154 (warning): bluebg is referenced but not assigned.


In bin/log-include.sh line 75:
        echo -e "${whiteb}${level}${white}$*${end}" >&3
                 ^-------^ SC2154 (warning): whiteb is referenced but not assigned.
                                  ^------^ SC2154 (warning): white is referenced but not assigned.
                                            ^----^ SC2154 (warning): end is referenced but not assigned.


In bin/log-include.sh line 89:
    echo -e "${greenb}${level}${whiteb}$*${end}" >&3
             ^-------^ SC2154 (warning): greenb is referenced but not assigned.


In bin/log-include.sh line 99:
		log_info $* >&3
                         ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.
                         ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
		log_info "$*" >&3


In bin/log-include.sh line 110:
    echo -e "${black}${yellowbg}${level}$*${end}" >&3
             ^------^ SC2154 (warning): black is referenced but not assigned.
                     ^---------^ SC2154 (warning): yellowbg is referenced but not assigned.


In bin/log-include.sh line 123:
    echo -e "${whiteb}${redbg}${level}$*${end}" >&3
                      ^------^ SC2154 (warning): redbg is referenced but not assigned.

For more information:
  https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2048 -- Use "$@" (with quotes) to prevent...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt -s' returned error 1 finding the following formatting issues:

----------
diff bin/log-include.sh.orig bin/log-include.sh
--- bin/log-include.sh.orig
+++ bin/log-include.sh
@@ -10,120 +10,119 @@
 
 # This must be run without 'set -e' being set
 # So it has to be done up here and not within log_notice
-if [ -z "$TERM" ] || ! tput cols >/dev/null 2>&1 ; then
-  # Non-interactive shell
-  LOG_COLOR_ENABLE=false
-  noticeColWidth=${LOG_NOTICE_COL_WIDTH:-100}
+if [ -z "$TERM" ] || ! tput cols >/dev/null 2>&1; then
+	# Non-interactive shell
+	LOG_COLOR_ENABLE=false
+	noticeColWidth=${LOG_NOTICE_COL_WIDTH:-100}
 else
-  # Terminal width should be accessible
-  noticeColWidth=${LOG_NOTICE_COL_WIDTH:-$(tput cols)}
-  if [ "$noticeColWidth" == "" ]; then
-    noticeColWidth=100
-  fi
+	# Terminal width should be accessible
+	noticeColWidth=${LOG_NOTICE_COL_WIDTH:-$(tput cols)}
+	if [ "$noticeColWidth" == "" ]; then
+		noticeColWidth=100
+	fi
 fi
 
 if [ "$LOG_VERBOSE_ENABLE" != "true" ]; then
-  # Send stdout to /dev/null
-  # All non-error command output (kubectl, helm, etc.) will be suppressed
-  # for non-verbose mode. log_* calls will funtion normally since they are
-  # sent to &3, which is a copy of stdout
-  exec 1>/dev/null
+	# Send stdout to /dev/null
+	# All non-error command output (kubectl, helm, etc.) will be suppressed
+	# for non-verbose mode. log_* calls will funtion normally since they are
+	# sent to &3, which is a copy of stdout
+	exec 1>/dev/null
 fi
 
 function add_notice {
-  echo $* >> $TMP_DIR/notices.txt
+	echo $* >>$TMP_DIR/notices.txt
 }
 
 function display_notices {
-  if [ -f "$TMP_DIR/notices.txt" ]; then
-     local IFS=''
-     cat $TMP_DIR/notices.txt | while read line || [[ -n "$line" ]];
-     do
-       log_notice "$line"
-     done
- fi
+	if [ -f "$TMP_DIR/notices.txt" ]; then
+		local IFS=''
+		cat $TMP_DIR/notices.txt | while read line || [[ -n $line ]]; do
+			log_notice "$line"
+		done
+	fi
 }
 
 function log_notice {
-  width=$noticeColWidth
-  n=$(($width - $(echo "$1" | wc -c)))
-  if [ $n -lt 0 ]; then
-     n=0
-  fi
-  # Fill remaining characters with spaces
-  text="$*$(printf %$(eval 'echo $n')s |tr ' ' ' ')"
-
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    whiteb "${bluebg}$text"
-  else
-    echo "$text" >&3
-  fi
+	width=$noticeColWidth
+	n=$((width - $(echo "$1" | wc -c)))
+	if [ $n -lt 0 ]; then
+		n=0
+	fi
+	# Fill remaining characters with spaces
+	text="$*$(printf %$(eval 'echo $n')s | tr ' ' ' ')"
+
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		whiteb "${bluebg}$text"
+	else
+		echo "$text" >&3
+	fi
 }
 
 function log_message {
-    echo "$*"  >&3
+	echo "$*" >&3
 }
 
 function log_debug {
-  if [ "$LOG_DEBUG_ENABLE" = "true" ]; then
-    if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-        level="DEBUG "
-    else
-        level=""
-    fi
-    if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-        echo -e "${whiteb}${level}${white}$*${end}" >&3
-    else
-        echo "${level}$*" >&3
-    fi
-  fi
+	if [ "$LOG_DEBUG_ENABLE" = "true" ]; then
+		if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+			level="DEBUG "
+		else
+			level=""
+		fi
+		if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+			echo -e "${whiteb}${level}${white}$*${end}" >&3
+		else
+			echo "${level}$*" >&3
+		fi
+	fi
 }
 
 function log_info {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="INFO "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${greenb}${level}${whiteb}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="INFO "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${greenb}${level}${whiteb}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 # Verbose messages are basically optional, more detailed INFO messages
 # The value of LOG_VERBOSE_ENABLE determines whether they are displayed
 function log_verbose {
-  if [ "$LOG_VERBOSE_ENABLE" == "true" ]; then
+	if [ "$LOG_VERBOSE_ENABLE" == "true" ]; then
 		log_info $* >&3
-  fi
+	fi
 }
 
 function log_warn {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="WARN "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${black}${yellowbg}${level}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="WARN "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${black}${yellowbg}${level}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 function log_error {
-  if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
-    level="ERROR "
-  else
-    level=""
-  fi
-  if [ "$LOG_COLOR_ENABLE" = "true" ]; then
-    echo -e "${whiteb}${redbg}${level}$*${end}" >&3
-  else
-    echo "${level}$*" >&3
-  fi
+	if [ "$LOG_LEVEL_ENABLE" = "true" ]; then
+		level="ERROR "
+	else
+		level=""
+	fi
+	if [ "$LOG_COLOR_ENABLE" = "true" ]; then
+		echo -e "${whiteb}${redbg}${level}$*${end}" >&3
+	else
+		echo "${level}$*" >&3
+	fi
 }
 
 export -f log_notice log_message log_debug log_info log_warn log_error add_notice display_notices log_verbose
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt -s -w filename


@gsmith-sas gsmith-sas merged commit 359a590 into main Feb 14, 2025
1 of 2 checks passed
@gsmith-sas gsmith-sas deleted the localifs branch February 14, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants