refactor: move all shellcheck disable definitions to .shellcheckrc file

This makes standard use of shellcheck work without needing to provide extra configuration anywhere.

Also remove use of inline 'shellcheck disable' calls that are already defined in the .shellcheckrc and don't need to be set inline.
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-01 04:21:46 -04:00
parent 4436bb2023
commit dac566e75e
36 changed files with 32 additions and 113 deletions

View File

@@ -24,7 +24,6 @@ main() {
# Disable the container restart policy
"$DOCKER_BIN" container update --restart=no "$cid" &>/dev/null || true
# shellcheck disable=SC2086
"$DOCKER_BIN" container stop $DOCKER_STOP_TIME_ARG "$cid" &>/dev/null
done
fi

View File

@@ -147,10 +147,8 @@ trigger-scheduler-docker-local-check-deploy() {
local FAILEDCHECKS=0
while read -r CHECK_URL EXPECTED; do
# Ignore empty lines and lines starting with #
# shellcheck disable=SC1001
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
# Ignore if it's not a URL in a supported format
# shellcheck disable=SC1001
! [[ "$CHECK_URL" =~ ^(http(s)?:)?\/.* ]] && continue
if [[ "$CHECK_URL" =~ ^https?: ]]; then
@@ -204,7 +202,6 @@ trigger-scheduler-docker-local-check-deploy() {
sleep "$WAIT"
# Capture HTTP response or CURL error message
# shellcheck disable=SC2086
if OUTPUT=$(curl -# $CURL_ARGS 2>&1); then
# OUTPUT contains the HTTP response
# shellcheck disable=SC2076

View File

@@ -88,7 +88,6 @@ fn-scheduler-docker-local-retire-container() {
# Attempt to stop, if that fails, then force a kill as docker seems
# to not send SIGKILL as the docs would indicate. If that fails, move
# on to the next.
# shellcheck disable=SC2086
"$DOCKER_BIN" container stop $DOCKER_STOP_TIME_ARG "$CID" \
|| "$DOCKER_BIN" container kill "$CID" \
|| dokku_log_warn "Unable to kill container ${CID}"

View File

@@ -13,7 +13,6 @@ trigger-scheduler-docker-local-post-delete() {
rm -rf "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP"
# remove all application containers
# shellcheck disable=SC2046
"$DOCKER_BIN" container ls --filter "label=com.dokku.app-name=${APP}" -q | xargs -n1 -I {} "$DOCKER_BIN" container rm --force {} &>/dev/null || true
}

View File

@@ -58,7 +58,6 @@ scheduler-docker-local-pre-deploy-chown-app() {
return
fi
# shellcheck disable=SC2086
"$DOCKER_BIN" container run --rm "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
}

View File

@@ -88,7 +88,6 @@ trigger-scheduler-docker-local-scheduler-deploy() {
# Attempt to stop, if that fails, then force a kill as docker seems
# to not send SIGKILL as the docs would indicate. If that fails, move
# on to the next.
# shellcheck disable=SC2086
"$DOCKER_BIN" container stop $DOCKER_STOP_TIME_ARG "$oldid" \
|| "$DOCKER_BIN" container kill "$oldid" \
|| plugn trigger retire-container-failed "$APP" "$oldid" # plugin trigger for event logging

View File

@@ -74,7 +74,6 @@ trigger-scheduler-docker-local-scheduler-enter() {
local IMAGE="$("$DOCKER_BIN" container inspect --format '{{ .Config.Image }}' "$CONTAINER_ID")"
is_image_herokuish_based "$IMAGE" "$APP" && EXEC_CMD="/exec"
is_image_cnb_based "$IMAGE" && EXEC_CMD="" && DOKKU_RUN_OPTS+=" -w /workspace"
# shellcheck disable=SC2086
"$DOCKER_BIN" container exec $DOKKU_RUN_OPTS "$CONTAINER_ID" $EXEC_CMD "${@:-$DOKKU_APP_SHELL}"
}

View File

@@ -13,7 +13,6 @@ fn-scheduler-docker-local-stop-container() {
fi
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
# shellcheck disable=SC2086
if "$DOCKER_BIN" container stop $DOCKER_STOP_TIME_ARG "$CONTAINER_ID_OR_NAME"; then
return
fi

View File

@@ -20,10 +20,8 @@ trigger-scheduler-docker-local-scheduler-stop() {
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
# Disable the container restart policy
# shellcheck disable=SC2086
"$DOCKER_BIN" container update --restart=no $DOKKU_APP_RUNNING_CONTAINER_IDS &>/dev/null || true
# shellcheck disable=SC2086
"$DOCKER_BIN" container stop $DOCKER_STOP_TIME_ARG $DOKKU_APP_RUNNING_CONTAINER_IDS >/dev/null || true
fi
@@ -35,7 +33,6 @@ trigger-scheduler-docker-local-scheduler-stop() {
plugn trigger scheduler-register-retired "$APP" "$CID"
done
# shellcheck disable=SC2086
"$DOCKER_BIN" container rm --force $DOKKU_APP_CIDS >/dev/null 2>&1 || true
fi
fi