Skip to content

add shfmt and shellcheck status checks #15

add shfmt and shellcheck status checks

add shfmt and shellcheck status checks #15

Triggered via pull request August 23, 2024 20:22
Status Failure
Total duration 19s
Artifacts

status-checks.yaml

on: pull_request
runner / shfmt
5s
runner / shfmt
runner / shellcheck
8s
runner / shellcheck
Fit to window
Zoom out
Zoom in

Annotations

9 errors and 20 warnings
runner / shfmt
reviewdog: Too many results (annotations) in diff. You may miss some annotations due to GitHub limitation for annotation created by logging command. Please check GitHub Actions log console to see all results. Limitation: - 10 warning annotations and 10 error annotations per step - 50 annotations per job (sum of annotations from all the steps) - 50 annotations per run (separate from the job annotations, these annotations aren't created by users) Source: https://github.com/orgs/community/discussions/26680#discussioncomment-3252835
runner / shfmt
Process completed with exit code 1.
runner / shellcheck
reviewdog: Too many results (annotations) in diff. You may miss some annotations due to GitHub limitation for annotation created by logging command. Please check GitHub Actions log console to see all results. Limitation: - 10 warning annotations and 10 error annotations per step - 50 annotations per job (sum of annotations from all the steps) - 50 annotations per run (separate from the job annotations, these annotations aren't created by users) Source: https://github.com/orgs/community/discussions/26680#discussioncomment-3252835
runner / shellcheck: zfs-replicate.sh#L37
[shellcheck] reported by reviewdog 🐶 Double quote array expansions to avoid re-splitting elements. Raw Output: ./zfs-replicate.sh:37:30: error: Double quote array expansions to avoid re-splitting elements. (ShellCheck.SC2068)
runner / shellcheck: zfs-replicate.sh#L45
[shellcheck] reported by reviewdog 🐶 Double quote array expansions to avoid re-splitting elements. Raw Output: ./zfs-replicate.sh:45:16: error: Double quote array expansions to avoid re-splitting elements. (ShellCheck.SC2068)
runner / shellcheck: config.sample.sh#L1
[shellcheck] reported by reviewdog 🐶 Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. Raw Output: ./config.sample.sh:1:1: error: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. (ShellCheck.SC2148)
runner / shellcheck: get-last-status.sh#L8
[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: get-last-status.sh:8:-if ! [ -e ${SCRIPTPATH}/logs ]; then get-last-status.sh:8:+if ! [ -e "${SCRIPTPATH}"/logs ]; then
runner / shellcheck: get-last-status.sh#L17
[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: get-last-status.sh:17:-RECENT_LOG_FILE=$(ls ${LOGS} | grep autorep- | tail -n 1) get-last-status.sh:18:-STATUS=$(tail -n 1 ${LOGS}/${RECENT_LOG_FILE}) get-last-status.sh:17:+RECENT_LOG_FILE=$(ls "${LOGS}" | grep autorep- | tail -n 1) get-last-status.sh:18:+STATUS=$(tail -n 1 "${LOGS}"/"${RECENT_LOG_FILE}")
runner / shellcheck
Process completed with exit code 2.
runner / shfmt: get-last-status.sh#L8
[shfmt] reported by reviewdog 🐶 Raw Output: get-last-status.sh:8:-if ! [ -e ${SCRIPTPATH}/logs ]; then get-last-status.sh:9:- echo "Log directory does not exist, can't check status." get-last-status.sh:10:- exit 0 get-last-status.sh:8:+if ! [ -e ${SCRIPTPATH}/logs ]; then get-last-status.sh:9:+ echo "Log directory does not exist, can't check status." get-last-status.sh:10:+ exit 0
runner / shfmt: zfs-replicate.sh#L10
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:10:- ## declare log array zfs-replicate.sh:11:- declare -a logs=() zfs-replicate.sh:12:- ## initialize index zfs-replicate.sh:10:+ ## declare log array zfs-replicate.sh:11:+ declare -a logs=() zfs-replicate.sh:12:+ ## initialize index zfs-replicate.sh:13:+ local index=0 zfs-replicate.sh:14:+ ## find existing logs zfs-replicate.sh:15:+ for log in $(${FIND} ${LOGBASE} -maxdepth 1 -type f -name autorep-\*); do zfs-replicate.sh:16:+ ## get file change time via stat (platform specific) zfs-replicate.sh:17:+ case "$(uname -s)" in zfs-replicate.sh:18:+ Linux | SunOS) zfs-replicate.sh:19:+ local fstat=$(stat -c %Z ${log}) zfs-replicate.sh:20:+ ;; zfs-replicate.sh:21:+ *) zfs-replicate.sh:22:+ local fstat=$(stat -f %c ${log}) zfs-replicate.sh:23:+ ;; zfs-replicate.sh:24:+ esac zfs-replicate.sh:25:+ ## append logs to array with creation time zfs-replicate.sh:26:+ logs[$index]="${fstat}\t${log}\n" zfs-replicate.sh:27:+ ## increase index zfs-replicate.sh:28:+ let "index += 1" zfs-replicate.sh:29:+ done zfs-replicate.sh:30:+ ## set log count zfs-replicate.sh:31:+ local lcount=${#logs[@]} zfs-replicate.sh:32:+ ## check count ... if greater than keep loop and delete zfs-replicate.sh:33:+ if [ $lcount -gt ${LOG_KEEP} ]; then zfs-replicate.sh:34:+ ## build new array in descending age order and reset index zfs-replicate.sh:35:+ declare -a slogs=()
runner / shfmt: zfs-replicate.sh#L14
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:14:- ## find existing logs zfs-replicate.sh:15:- for log in $(${FIND} ${LOGBASE} -maxdepth 1 -type f -name autorep-\*); do zfs-replicate.sh:16:- ## get file change time via stat (platform specific) zfs-replicate.sh:17:- case "$(uname -s)" in zfs-replicate.sh:18:- Linux|SunOS) zfs-replicate.sh:19:- local fstat=$(stat -c %Z ${log}) zfs-replicate.sh:20:- ;; zfs-replicate.sh:21:- *) zfs-replicate.sh:22:- local fstat=$(stat -f %c ${log}) zfs-replicate.sh:23:- ;; zfs-replicate.sh:24:- esac zfs-replicate.sh:25:- ## append logs to array with creation time zfs-replicate.sh:26:- logs[$index]="${fstat}\t${log}\n" zfs-replicate.sh:27:- ## increase index zfs-replicate.sh:28:- let "index += 1" zfs-replicate.sh:37:+ ## loop through existing array zfs-replicate.sh:38:+ for log in $(echo -e ${logs[@]:0} | sort -rn | cut -f2); do zfs-replicate.sh:39:+ ## append log to array zfs-replicate.sh:40:+ slogs[$index]=${log} zfs-replicate.sh:41:+ ## increase index zfs-replicate.sh:42:+ let "index += 1"
runner / shfmt: zfs-replicate.sh#L30
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:30:- ## set log count zfs-replicate.sh:31:- local lcount=${#logs[@]} zfs-replicate.sh:32:- ## check count ... if greater than keep loop and delete zfs-replicate.sh:33:- if [ $lcount -gt ${LOG_KEEP} ]; then zfs-replicate.sh:34:- ## build new array in descending age order and reset index zfs-replicate.sh:35:- declare -a slogs=(); local index=0 zfs-replicate.sh:36:- ## loop through existing array zfs-replicate.sh:37:- for log in $(echo -e ${logs[@]:0} | sort -rn | cut -f2); do zfs-replicate.sh:38:- ## append log to array zfs-replicate.sh:39:- slogs[$index]=${log} zfs-replicate.sh:40:- ## increase index zfs-replicate.sh:41:- let "index += 1" zfs-replicate.sh:42:- done zfs-replicate.sh:43:- ## delete excess logs zfs-replicate.sh:44:- printf "deleting old logs: %s ...\n" "${slogs[@]:${LOG_KEEP}}" zfs-replicate.sh:45:- rm -rf ${slogs[@]:${LOG_KEEP}} zfs-replicate.sh:46:- fi zfs-replicate.sh:44:+ ## delete excess logs zfs-replicate.sh:45:+ printf "deleting old logs: %s ...\n" "${slogs[@]:${LOG_KEEP}}" zfs-replicate.sh:46:+ rm -rf ${slogs[@]:${LOG_KEEP}} zfs-replicate.sh:47:+ fi
runner / shfmt: zfs-replicate.sh#L50
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:50:-exit_clean () { zfs-replicate.sh:51:- ## print errors zfs-replicate.sh:52:- if [ "${1}x" != "x" ] && [ ${1} != 0 ]; then zfs-replicate.sh:53:- printf "Last operation returned error code: %s\n" "${1}" zfs-replicate.sh:54:- fi zfs-replicate.sh:55:- ## check log files zfs-replicate.sh:56:- check_old_log zfs-replicate.sh:57:- clear_lock "${LOGBASE}"/.push.lock zfs-replicate.sh:58:- clear_lock "${LOGBASE}"/.pull.lock zfs-replicate.sh:59:- clear_lock "${LOGBASE}"/.snapshot.lock zfs-replicate.sh:60:- ## always exit 0 zfs-replicate.sh:61:- printf "SUCCESS\n" zfs-replicate.sh:62:- exit 0 zfs-replicate.sh:51:+exit_clean() { zfs-replicate.sh:52:+ ## print errors zfs-replicate.sh:53:+ if [ "${1}x" != "x" ] && [ ${1} != 0 ]; then zfs-replicate.sh:54:+ printf "Last operation returned error code: %s\n" "${1}" zfs-replicate.sh:55:+ fi zfs-replicate.sh:56:+ ## check log files zfs-replicate.sh:57:+ check_old_log zfs-replicate.sh:58:+ clear_lock "${LOGBASE}"/.push.lock zfs-replicate.sh:59:+ clear_lock "${LOGBASE}"/.pull.lock zfs-replicate.sh:60:+ clear_lock "${LOGBASE}"/.snapshot.lock zfs-replicate.sh:61:+ ## always exit 0 zfs-replicate.sh:62:+ printf "SUCCESS\n" zfs-replicate.sh:63:+ exit 0
runner / shfmt: zfs-replicate.sh#L65
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:65:-exit_error () { zfs-replicate.sh:66:- ## print errors zfs-replicate.sh:67:- if [ "${1}x" != "x" ] && [ ${1} != 0 ]; then zfs-replicate.sh:68:- printf "Last operation returned error code: %s\n" "${1}" zfs-replicate.sh:69:- fi zfs-replicate.sh:70:- ## check log files zfs-replicate.sh:71:- check_old_log zfs-replicate.sh:72:- clear_lock "${LOGBASE}"/.push.lock zfs-replicate.sh:73:- clear_lock "${LOGBASE}"/.pull.lock zfs-replicate.sh:74:- clear_lock "${LOGBASE}"/.snapshot.lock zfs-replicate.sh:75:- printf "FAILED\n" zfs-replicate.sh:76:- exit 0 zfs-replicate.sh:66:+exit_error() { zfs-replicate.sh:67:+ ## print errors zfs-replicate.sh:68:+ if [ "${1}x" != "x" ] && [ ${1} != 0 ]; then zfs-replicate.sh:69:+ printf "Last operation returned error code: %s\n" "${1}" zfs-replicate.sh:70:+ fi zfs-replicate.sh:71:+ ## check log files zfs-replicate.sh:72:+ check_old_log zfs-replicate.sh:73:+ clear_lock "${LOGBASE}"/.push.lock zfs-replicate.sh:74:+ clear_lock "${LOGBASE}"/.pull.lock zfs-replicate.sh:75:+ clear_lock "${LOGBASE}"/.snapshot.lock zfs-replicate.sh:76:+ printf "FAILED\n" zfs-replicate.sh:77:+ exit 0
runner / shfmt: zfs-replicate.sh#L81
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:81:- ## check our lockfile status zfs-replicate.sh:82:- if [ -f "${1}" ]; then zfs-replicate.sh:83:- ## get lockfile contents zfs-replicate.sh:84:- local lpid=$(cat "${1}") zfs-replicate.sh:85:- ## see if this pid is still running zfs-replicate.sh:86:- local ps=$(ps auxww|grep $lpid|grep -v grep) zfs-replicate.sh:87:- if [ "${ps}x" != 'x' ]; then zfs-replicate.sh:88:- ## looks like it's still running zfs-replicate.sh:89:- printf "ERROR: This script is already running as: %s\n" "${ps}" zfs-replicate.sh:90:- else zfs-replicate.sh:91:- ## well the lockfile is there...stale? zfs-replicate.sh:92:- printf "ERROR: Lockfile exists: %s\n" "${1}" zfs-replicate.sh:93:- printf "However, the contents do not match any " zfs-replicate.sh:94:- printf "currently running process...stale lockfile?\n" zfs-replicate.sh:95:- fi zfs-replicate.sh:96:- ## tell em what to do... zfs-replicate.sh:97:- printf "To run script please delete: %s\n" "${1}" zfs-replicate.sh:98:- ## compress log and exit... zfs-replicate.sh:99:- exit_error zfs-replicate.sh:82:+ ## check our lockfile status zfs-replicate.sh:83:+ if [ -f "${1}" ]; then zfs-replicate.sh:84:+ ## get lockfile contents zfs-replicate.sh:85:+ local lpid=$(cat "${1}") zfs-replicate.sh:86:+ ## see if this pid is still running zfs-replicate.sh:87:+ local ps=$(ps auxww | grep $lpid | grep -v grep) zfs-replicate.sh:88:+ if [ "${ps}x" != 'x' ]; then zfs-replicate.sh:89:+ ## looks like it's still running zfs-replicate.sh:90:+ printf "ERROR: This script is already running as: %s\n" "${ps}"
runner / shfmt: zfs-replicate.sh#L101
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:101:- ## well no lockfile..let's make a new one zfs-replicate.sh:102:- printf "Creating lockfile: %s\n" "${1}" zfs-replicate.sh:103:- echo $$ > "${1}" zfs-replicate.sh:92:+ ## well the lockfile is there...stale? zfs-replicate.sh:93:+ printf "ERROR: Lockfile exists: %s\n" "${1}" zfs-replicate.sh:94:+ printf "However, the contents do not match any " zfs-replicate.sh:95:+ printf "currently running process...stale lockfile?\n"
runner / shfmt: zfs-replicate.sh#L105
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:97:+ ## tell em what to do... zfs-replicate.sh:98:+ printf "To run script please delete: %s\n" "${1}" zfs-replicate.sh:99:+ ## compress log and exit... zfs-replicate.sh:100:+ exit_error zfs-replicate.sh:101:+ else zfs-replicate.sh:102:+ ## well no lockfile..let's make a new one zfs-replicate.sh:103:+ printf "Creating lockfile: %s\n" "${1}" zfs-replicate.sh:104:+ echo $$ > "${1}" zfs-replicate.sh:105:+ fi
runner / shfmt: zfs-replicate.sh#L109
[shfmt] reported by reviewdog 🐶 Raw Output: zfs-replicate.sh:109:- ## delete lockfiles...and that's all we do here zfs-replicate.sh:110:- if [ -f "${1}" ]; then zfs-replicate.sh:111:- printf "Deleting lockfile: %s\n" "${1}" zfs-replicate.sh:112:- rm "${1}" zfs-replicate.sh:113:- fi zfs-replicate.sh:110:+ ## delete lockfiles...and that's all we do here zfs-replicate.sh:111:+ if [ -f "${1}" ]; then zfs-replicate.sh:112:+ printf "Deleting lockfile: %s\n" "${1}" zfs-replicate.sh:113:+ rm "${1}" zfs-replicate.sh:114:+ fi
runner / shellcheck: get-last-status.sh#L8
[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. Raw Output: ./get-last-status.sh:8:12: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
runner / shellcheck: get-last-status.sh#L17
[shellcheck] reported by reviewdog 🐶 Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames. Raw Output: ./get-last-status.sh:17:19: warning: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames. (ShellCheck.SC2010)
runner / shellcheck: get-last-status.sh#L17
[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. Raw Output: ./get-last-status.sh:17:22: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
runner / shellcheck: get-last-status.sh#L18
[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. Raw Output: ./get-last-status.sh:18:20: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
runner / shellcheck: get-last-status.sh#L18
[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. Raw Output: ./get-last-status.sh:18:28: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
runner / shellcheck: zfs-replicate.sh#L15
[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. Raw Output: ./zfs-replicate.sh:15:26: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
runner / shellcheck: zfs-replicate.sh#L19
[shellcheck] reported by reviewdog 🐶 Declare and assign separately to avoid masking return values. Raw Output: ./zfs-replicate.sh:19:23: warning: Declare and assign separately to avoid masking return values. (ShellCheck.SC2155)
runner / shellcheck: zfs-replicate.sh#L19
[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. Raw Output: ./zfs-replicate.sh:19:42: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
runner / shellcheck: zfs-replicate.sh#L22
[shellcheck] reported by reviewdog 🐶 Declare and assign separately to avoid masking return values. Raw Output: ./zfs-replicate.sh:22:23: warning: Declare and assign separately to avoid masking return values. (ShellCheck.SC2155)
runner / shellcheck: zfs-replicate.sh#L22
[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. Raw Output: ./zfs-replicate.sh:22:42: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)