You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
report() {
local status
local timestamp
local ERR_MSG
local PASSMSG
local NOTEMSG
local output_message
local log_message
local message
local status=$1 # F = failure, P = pass, N = notice (neutral), B = Blank
local message=$2
local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
local ERR_MSG="[$timestamp] ERROR: "
local PASSMSG="[$timestamp] SUCCESS: "
local NOTEMSG="[$timestamp] NOTICE: "
# Ensure color variables are defined
if [[ -z "$RED" ]]; then
output_message="[$timestamp] $message"
log_message="[$timestamp] $message" # Plain message for log
else
case "$status" in
F) output_message="${RED}$ERR_MSG ${WHITE}$message${RESET}"
log_message="$ERR_MSG $message" ;; # Plain message for log
P) output_message="${GREEN}$PASSMSG ${WHITE}$message${RESET}"
log_message="$PASSMSG $message" ;; # Plain message for log
N) output_message="${YELLOW}$NOTEMSG ${WHITE}$message${RESET}"
log_message="$NOTEMSG $message" ;; # Plain message for log
B) output_message="${WHITE}$message${RESET}"
log_message="$message" ;; # Plain message for log
*) output_message="${RED}$ERR_MSG ${WHITE}$status is an unsupported status flag.${RESET}"
log_message="$ERR_MSG $status is an unsupported status flag." ;; # Plain message for log
esac
fi
# Output to terminal
echo -e "$output_message"
# Log to run.log
doLog "rebuild" "$log_message" # Log the plain message
}
The line local timestamp=$(date +"%Y-%m-%d %H:%M:%S") gets flagged with SC2155 despite the previous entry of local timestamp.
The text was updated successfully, but these errors were encountered:
In this function:
The line
local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
gets flagged with SC2155 despite the previous entry oflocal timestamp
.The text was updated successfully, but these errors were encountered: