From c9f3aad89cf7cc2533d89565b69d254631b2d0d4 Mon Sep 17 00:00:00 2001 From: igor04091968 Date: Thu, 7 May 2026 12:35:23 +0300 Subject: [PATCH] fix(shell): address ShellCheck warnings (remove SC2181 checks, safer prompt_secret, add selective suppressions)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Sync_from_git.sh | 1 + Sync_to_git.sh | 1 + check-aw-data.sh | 2 +- check-aw-full.sh | 2 +- proxmox/create-ct.sh | 1 + proxmox/push-aw-artifacts.sh | 1 + scripts/check_install_kit_vs_repo.sh | 1 + scripts/prod_rollout.sh | 6 ++++-- 8 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Sync_from_git.sh b/Sync_from_git.sh index 91f58e5..279f28a 100755 --- a/Sync_from_git.sh +++ b/Sync_from_git.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1007 set -eu REPO_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) diff --git a/Sync_to_git.sh b/Sync_to_git.sh index 15e2e86..82019a6 100755 --- a/Sync_to_git.sh +++ b/Sync_to_git.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1007 set -eu REPO_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) diff --git a/check-aw-data.sh b/check-aw-data.sh index 4d0f960..94059b9 100644 --- a/check-aw-data.sh +++ b/check-aw-data.sh @@ -18,7 +18,7 @@ echo "=== ActivityWatch Data Check: $HOSTNAME_FILTER ===" echo "" echo -n "Server connectivity... " RESP=$(no_proxy=10.10.10.13 curl -s --connect-timeout 10 --max-time 15 "$SERVER/api/0/info" 2>&1) -if [ $? -eq 0 ] && echo "$RESP" | jq -e '.version' > /dev/null 2>&1; then +if echo "$RESP" | jq -e '.version' > /dev/null 2>&1; then VERSION=$(echo "$RESP" | jq -r '.version') echo -e "${GREEN}OK${NC} (aw-server v$VERSION)" else diff --git a/check-aw-full.sh b/check-aw-full.sh index ce31168..160b387 100644 --- a/check-aw-full.sh +++ b/check-aw-full.sh @@ -22,7 +22,7 @@ echo "" echo -e "${CYAN}--- 1. AW Server ($SERVER) ---${NC}" echo -n " Connectivity... " RESP=$(no_proxy=10.10.10.13 curl -s --connect-timeout 10 --max-time 15 "$SERVER/api/0/info" 2>&1) -if [ $? -eq 0 ] && echo "$RESP" | jq -e '.version' > /dev/null 2>&1; then +if echo "$RESP" | jq -e '.version' > /dev/null 2>&1; then VERSION=$(echo "$RESP" | jq -r '.version') echo -e " ${GREEN}OK${NC} (aw-server $VERSION)" else diff --git a/proxmox/create-ct.sh b/proxmox/create-ct.sh index c92ef25..1d2fe59 100755 --- a/proxmox/create-ct.sh +++ b/proxmox/create-ct.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1007 set -eu SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) diff --git a/proxmox/push-aw-artifacts.sh b/proxmox/push-aw-artifacts.sh index d3b2d91..0db6733 100755 --- a/proxmox/push-aw-artifacts.sh +++ b/proxmox/push-aw-artifacts.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1007 set -eu SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) diff --git a/scripts/check_install_kit_vs_repo.sh b/scripts/check_install_kit_vs_repo.sh index 97d165d..d1d87ae 100755 --- a/scripts/check_install_kit_vs_repo.sh +++ b/scripts/check_install_kit_vs_repo.sh @@ -4,6 +4,7 @@ set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT_DIR" +# shellcheck disable=SC2034 KIT_DIR="install-kit-awindows-20260427-211240" python - <<'PY' diff --git a/scripts/prod_rollout.sh b/scripts/prod_rollout.sh index 1f9ebfd..1e6b674 100644 --- a/scripts/prod_rollout.sh +++ b/scripts/prod_rollout.sh @@ -21,9 +21,11 @@ prompt_secret() { if [[ -n "${!var_name:-}" ]]; then return 0 fi - read -r -s -p "${prompt}: " "$var_name" + local _val + read -r -s -p "${prompt}: " _val echo - export "$var_name" + printf -v "$var_name" '%s' "$_val" + declare -gx "$var_name" } require_cmd git