Skip to content

Commit

Permalink
Merge pull request AllskyTeam#4081 from AllskyTeam/SC2086-fixes
Browse files Browse the repository at this point in the history
SC2086 fixes
  • Loading branch information
Alex-developer authored Dec 18, 2024
2 parents 09e98c5 + 8a3d567 commit c07ded4
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci_shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
push:
paths:
- '*.sh'
- '*/*.sh'
- '*/*/*.sh'
- 'scripts/*.sh'
- 'scripts/utilities/*.sh'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -27,7 +27,7 @@ jobs:
run: |
# check bash files (bash -n, shellcheck -x)
err=0
for i in $(find . -maxdepth 2 -name '*.sh'); do
for i in $(find . -maxdepth 3 -name '*.sh'); do
echo "==================== $i"
bash -n $i
if [ $? -ne 0 ]; then
Expand Down
6 changes: 3 additions & 3 deletions remoteWebsiteInstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function enter_yes_no()
fi
done

return ${RESULT}
return "${RESULT}"
}

# prompt the user to press any key.
Expand Down Expand Up @@ -163,7 +163,7 @@ function display_box()
else
echo -e "${DIALOG_TEXT}"
fi
return ${RET}
return "${RET}"
fi

# Don't use: it's redundant most of the time --backtitle "${DIALOG_BACK_TITLE}" \
Expand Down Expand Up @@ -593,7 +593,7 @@ function check_if_files_exist()
fi
done

return ${RET_CODE}
return "${RET_CODE}"
}

# Deletes a file from the remote server.
Expand Down
2 changes: 1 addition & 1 deletion scripts/checkAllsky.sh
Original file line number Diff line number Diff line change
Expand Up @@ -868,4 +868,4 @@ else
fi
fi

exit ${RET}
exit "${RET}"
4 changes: 2 additions & 2 deletions scripts/generateForDay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ if [[ ${TYPE} == "GENERATE" ]]; then
[[ -n ${DEBUG_ARG} ]] && echo "${ME}: Executing: ${CMD}"
# shellcheck disable=SC2086
eval ${CMD}
RET=$?
local RET=$?
if [[ ${RET} -ne 0 ]]; then
echo -e "${RED}${ME}: Command Failed: ${CMD}${NC}"
elif [[ ${SILENT} == "false" ]]; then
echo -e "\tDone"
fi

return ${RET}
return "${RET}"
}

else
Expand Down
6 changes: 3 additions & 3 deletions scripts/installUpgradeFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,9 @@ function replace_website_placeholders()
config.camera "camera" "${CAMERA}" \
config.lens "lens" "${LENS}" \
config.computer "computer" "${COMPUTER}" \
config.AllskyVersion "AllskyVersion" "${ALLSKY_VERSION}" \
${MINI_TLAPSE_DISPLAY} "mini_display" "${MINI_TLAPSE_DISPLAY_VALUE}" \
${MINI_TLAPSE_URL} "mini_url" "${MINI_TLAPSE_URL_VALUE}"
"${WEBSITE_ALLSKY_VERSION}" "AllskyVersion" "${ALLSKY_VERSION}" \
"${MINI_TLAPSE_DISPLAY}" "mini_display" "${MINI_TLAPSE_DISPLAY_VALUE}" \
"${MINI_TLAPSE_URL}" "mini_url" "${MINI_TLAPSE_URL_VALUE}"
}


Expand Down
2 changes: 1 addition & 1 deletion scripts/postData.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ while [[ $# -gt 0 ]]; do
esac
shift
done
[[ ${RET} -ne 0 ]] && usage_and_exit ${RET}
[[ ${RET} -ne 0 ]] && usage_and_exit "${RET}"
[[ ${HELP} == "true" ]] && usage_and_exit 0


Expand Down
4 changes: 2 additions & 2 deletions scripts/postToMap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function check_URL()

else
# Make sure it's a valid URL. Some servers don't return anything if the user agent is "curl".
local CONTENT="$( curl --user-agent Allsky --location --head --silent --show-error --connect-timeout ${TIMEOUT} "${URL}" 2>&1 )"
local CONTENT="$( curl --user-agent Allsky --location --head --silent --show-error --connect-timeout "${TIMEOUT}" "${URL}" 2>&1 )"
local RET=$?
if [[ ${DEBUG} == "true" ]]; then
echo -e "\n${wDEBUG}"
Expand Down Expand Up @@ -356,7 +356,7 @@ if [[ ${UPLOAD} == "true" ]]; then
else
echo -e "${ERROR_MSG_START}${E}${wNC}"
fi
exit ${RETURN_CODE}
exit "${RETURN_CODE}"
fi

# Get the return string from the server. It's the last line of output.
Expand Down
2 changes: 1 addition & 1 deletion scripts/saveImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ if [[ ${SAVE_IMAGE} == "true" ]]; then
# Remove the oldest files if we haven't reached the limit.
if [[ ${LEFT} -le 0 ]]; then
KEEP=$((TIMELAPSE_MINI_IMAGES - TIMELAPSE_MINI_FREQUENCY))
x="$( tail -${KEEP} "${MINI_TIMELAPSE_FILES}" )"
x="$( tail "-${KEEP}" "${MINI_TIMELAPSE_FILES}" )"
echo -e "${x}" > "${MINI_TIMELAPSE_FILES}"
if [[ ${ALLSKY_DEBUG_LEVEL} -ge 3 ]]; then
echo -en "${YELLOW}${ME}: Replaced ${TIMELAPSE_MINI_FREQUENCY} oldest, LEFT=$LEFT, KEEP=$KEEP"
Expand Down
2 changes: 1 addition & 1 deletion scripts/testUpload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,4 @@ if [[ -s ${MSG_FILE} ]]; then
fi
rm -f "${MSG_FILE}"

exit ${RET}
exit "${RET}"
15 changes: 11 additions & 4 deletions scripts/utilities/allsky-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ while [[ $# -gt 0 ]]; do
*)
CMD="${ARG}"
shift
# shellcheck disable=SC2124
CMD_ARGS="${@}"
break;
;;
Expand Down Expand Up @@ -84,6 +85,7 @@ PATH="${PATH}:${ALLSKY_UTILITIES}"
# Show all the supported cameras.
function show_supported_cameras()
{
# shellcheck disable=SC2124
local ARGS="${@}"

#shellcheck disable=SC2086
Expand All @@ -98,7 +100,7 @@ function show_supported_cameras()
ARGS="$( prompt "${PROMPT}" "${OPTS[@]}" )"
fi

#shellcheck disable=SC2086
# shellcheck disable=SC2086
show_supported_cameras.sh ${ARGS}
}

Expand All @@ -114,10 +116,13 @@ function show_connected_cameras()
else
local FORMAT="%-6s %-8s %s\n"
echo
# shellcheck disable=SC2059
printf "${FORMAT}" "Type" "Number" "Model"
# shellcheck disable=SC2059
printf "${FORMAT}" "====" "======" "====="
echo -e "${CAMERAS}" | while read -r TYPE NUM MODEL
do
# shellcheck disable=SC2059
printf "${FORMAT}" "${TYPE}" "${NUM}" "${MODEL}"
done
fi
Expand All @@ -127,9 +132,10 @@ function show_connected_cameras()
# Show all the currently connected cameras.
function new_rpi_camera_info()
{
# shellcheck disable=SC2124
local ARGS="${@}" # optional

#shellcheck disable=SC2086
# shellcheck disable=SC2086
get_RPi_camera_info.sh ${ARGS}
}

Expand Down Expand Up @@ -232,6 +238,7 @@ function run_command()
{
COMMAND="${1}"
shift
# shellcheck disable=SC2124
ARGUMENTS="${@}"
if ! type "${COMMAND}" > /dev/null 2>&1 ; then
echo -e "\n${RED}${ME}: Unknown command '${COMMAND}'.${NC}" >&2
Expand Down Expand Up @@ -268,7 +275,7 @@ function prompt()
exit 2
else
echo "${OPT}"
return ${RET}
return "${RET}"
fi
}

Expand All @@ -294,7 +301,7 @@ if [[ -z ${CMD} ]]; then
run_command "${COMMAND}"
RET=$?

[[ ${ALLOW_MORE_COMMANDS} == "false" ]] && exit ${RET}
[[ ${ALLOW_MORE_COMMANDS} == "false" ]] && exit "${RET}"
while true; do
echo -e "\n\n"
echo -e "${YELLOW}${BOLD}"
Expand Down
1 change: 1 addition & 0 deletions scripts/utilities/installSamba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ echo
echo -en "${BOLD}"
echo "============================================="
echo -n "Press RETURN to continue with installation: "
# shellcheck disable=SC2034
read -r x
echo -e "${NC}"

Expand Down

0 comments on commit c07ded4

Please sign in to comment.