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:
@@ -4,5 +4,4 @@ set -eo pipefail
|
||||
DOKKU_DOCKER_CONTAINER_NAME=${DOKKU_DOCKER_CONTAINER_NAME:=dokku}
|
||||
|
||||
# TODO: handle cases where we need a tty
|
||||
# shellcheck disable=SC2086
|
||||
docker exec $DOKKU_DOCKER_ENV -i "$DOKKU_DOCKER_CONTAINER_NAME" dokku "$@"
|
||||
|
||||
@@ -190,7 +190,6 @@ main() {
|
||||
[[ -n "$APP_ARG" ]] && [[ "$APP_ARG" == "--global" ]] && unset APP
|
||||
[[ -n "$@" ]] && [[ -n "$APP" ]] && app_arg="--app $APP"
|
||||
# echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@"
|
||||
# shellcheck disable=SC2068,SC2086
|
||||
ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@ || {
|
||||
ssh_exit_code="$?"
|
||||
echo " ! Failed to execute dokku command over ssh: exit code $?" 1>&2
|
||||
|
||||
@@ -31,7 +31,6 @@ cmdExists() {
|
||||
function getDistro {
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org and systemd
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
@@ -41,7 +40,6 @@ function getDistro {
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# For some versions of Debian/Ubuntu without lsb_release command
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
@@ -255,11 +253,9 @@ function checkUsers {
|
||||
if [[ "${u[0]}" == "${user}" ]]; then
|
||||
if [[ ${u[1]} == "!" ]] || [[ ${u[1]} == "!!" ]] || [[ ${u[1]} == "*" ]]; then
|
||||
echo -en "\e[32m[PASS]\e[0m User ${user} has no password set.\n"
|
||||
# shellcheck disable=SC2030
|
||||
((PASS++))
|
||||
else
|
||||
echo -en "\e[41m[FAIL]\e[0m User ${user} has a password set on their account. Only system users are allowed on the image.\n"
|
||||
# shellcheck disable=SC2030
|
||||
((FAIL++))
|
||||
STATUS=2
|
||||
fi
|
||||
@@ -292,7 +288,6 @@ function checkUsers {
|
||||
STATUS=2
|
||||
else
|
||||
echo -en "\e[93m[WARN]\e[0m User \e[1m${user}\e[0m has empty private key file in \e[93m${key}\e[0m\n"
|
||||
# shellcheck disable=SC2030
|
||||
((WARN++))
|
||||
if [[ $STATUS != 2 ]]; then
|
||||
STATUS=1
|
||||
@@ -352,11 +347,9 @@ function checkFirewall {
|
||||
ufwa=$(ufw status | head -1 | sed -e "s/^Status:\ //")
|
||||
if [[ $ufwa == "active" ]]; then
|
||||
FW_VER="\e[32m[PASS]\e[0m Firewall service (${fw}) is active\n"
|
||||
# shellcheck disable=SC2031
|
||||
((PASS++))
|
||||
else
|
||||
FW_VER="\e[93m[WARN]\e[0m No firewall is configured. Ensure ${fw} is installed and configured\n"
|
||||
# shellcheck disable=SC2031
|
||||
((WARN++))
|
||||
fi
|
||||
elif [[ $OS == "CentOS Linux" ]] || [[ $OS == "CentOS Stream" ]] || [[ $OS == "Rocky Linux" ]] || [[ $OS == "AlmaLinux" ]]; then
|
||||
@@ -451,7 +444,6 @@ function checkUpdates {
|
||||
sleep 2
|
||||
apt-get --just-print upgrade | grep -i security | awk '{print $2}' | awk '!seen[$0]++'
|
||||
echo -en
|
||||
# shellcheck disable=SC2031
|
||||
((FAIL++))
|
||||
STATUS=2
|
||||
else
|
||||
|
||||
@@ -9,19 +9,16 @@ readonly DOKKU_GIT_REV="$(git rev-parse HEAD)"
|
||||
trap "rm -rf '$TMP_WORK_DIR' >/dev/null" RETURN INT TERM EXIT
|
||||
|
||||
log-info() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log info formatter"
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
log-error() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log error formatter"
|
||||
echo "! $*" 1>&2
|
||||
}
|
||||
|
||||
log-fail() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log fail formatter"
|
||||
log-error "$*"
|
||||
exit 1
|
||||
|
||||
@@ -7,19 +7,16 @@ readonly TMP_WORK_DIR="$(mktemp -d "/tmp/dokku-plugin-release.XXXXXX")"
|
||||
trap "rm -rf '$TMP_WORK_DIR' >/dev/null" RETURN INT TERM EXIT
|
||||
|
||||
log-info() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log info formatter"
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
log-error() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log error formatter"
|
||||
echo "! $*" 1>&2
|
||||
}
|
||||
|
||||
log-fail() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log fail formatter"
|
||||
log-error "$*"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user