Skip to content

Commit f9c2a21

Browse files
Update shellcheck directives to improve configuration sourcing in automation scripts
1 parent 23c4231 commit f9c2a21

7 files changed

Lines changed: 28 additions & 12 deletions

automation/cleanup_reports.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ COMPRESS_OLD="true"
3131
# Load configuration
3232
CONFIG_FILE="$SCRIPT_DIR/pgtools.conf"
3333
if [[ -f "$CONFIG_FILE" ]]; then
34-
# shellcheck source=automation/pgtools.conf
34+
# shellcheck disable=SC1091
35+
# shellcheck source=pgtools.conf
3536
source "$CONFIG_FILE"
3637
KEEP_DAYS="${PGTOOLS_KEEP_REPORTS_DAYS:-$KEEP_DAYS}"
3738
fi

automation/export_metrics.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ EOF
6767
# Load configuration
6868
CONFIG_FILE="$SCRIPT_DIR/pgtools.conf"
6969
if [[ -f "$CONFIG_FILE" ]]; then
70-
# shellcheck source=automation/pgtools.conf
70+
# shellcheck disable=SC1091
71+
# shellcheck source=pgtools.conf
7172
source "$CONFIG_FILE"
7273
fi
7374

automation/pgtools_health_check.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ mkdir -p "$OUTPUT_DIR"
152152
# Load configuration if available
153153
if [[ -f "$CONFIG_FILE" ]]; then
154154
log "Loading configuration from $CONFIG_FILE"
155-
# shellcheck source=automation/pgtools.conf
155+
# shellcheck disable=SC1091
156+
# shellcheck source=pgtools.conf
156157
source "$CONFIG_FILE"
157158
else
158159
warn "Configuration file not found: $CONFIG_FILE"
@@ -243,12 +244,20 @@ run_health_checks() {
243244
scripts_to_run="ESSENTIAL_SCRIPTS"
244245
else
245246
log "Running full health check"
246-
scripts_to_run="FULL_SCRIPTS"
247-
248-
# Add essential scripts to full run
247+
# shellcheck disable=SC2034 # referenced through nameref
248+
local -A combined_scripts=()
249+
local key
250+
251+
for key in "${!FULL_SCRIPTS[@]}"; do
252+
combined_scripts["$key"]="${FULL_SCRIPTS[$key]}"
253+
done
254+
# shellcheck disable=SC2034
249255
for key in "${!ESSENTIAL_SCRIPTS[@]}"; do
250-
FULL_SCRIPTS["$key"]="${ESSENTIAL_SCRIPTS[$key]}"
256+
combined_scripts["$key"]="${ESSENTIAL_SCRIPTS[$key]}"
251257
done
258+
# shellcheck enable=SC2034
259+
260+
scripts_to_run="combined_scripts"
252261
fi
253262

254263
local -n scripts_ref=$scripts_to_run

automation/pgtools_scheduler.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ EOF
6161
# Load configuration
6262
CONFIG_FILE="$SCRIPT_DIR/pgtools.conf"
6363
if [[ -f "$CONFIG_FILE" ]]; then
64-
# shellcheck source=automation/pgtools.conf
64+
# shellcheck disable=SC1091
65+
# shellcheck source=pgtools.conf
6566
source "$CONFIG_FILE"
6667
else
6768
warn "Configuration file not found: $CONFIG_FILE"
6869
warn "Using defaults and example configuration"
6970
if [[ -f "$SCRIPT_DIR/pgtools.conf.example" ]]; then
70-
# shellcheck source=automation/pgtools.conf.example
71+
# shellcheck disable=SC1091
72+
# shellcheck source=pgtools.conf.example
7173
source "$SCRIPT_DIR/pgtools.conf.example"
7274
fi
7375
fi

automation/run_hot_update_report.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ EOF
4242
}
4343

4444
if [[ -f "$CONFIG_FILE" ]]; then
45-
# shellcheck source=automation/pgtools.conf
45+
# shellcheck disable=SC1091
46+
# shellcheck source=pgtools.conf
4647
source "$CONFIG_FILE"
4748
fi
4849

automation/run_security_audit.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ EOF
6161
# Load configuration
6262
CONFIG_FILE="$SCRIPT_DIR/pgtools.conf"
6363
if [[ -f "$CONFIG_FILE" ]]; then
64-
# shellcheck source=automation/pgtools.conf
64+
# shellcheck disable=SC1091
65+
# shellcheck source=pgtools.conf
6566
source "$CONFIG_FILE"
6667
fi
6768

automation/test_pgtools.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ fi
106106
# Load configuration
107107
CONFIG_FILE="$SCRIPT_DIR/pgtools.conf"
108108
if [[ -f "$CONFIG_FILE" ]]; then
109-
# shellcheck source=automation/pgtools.conf
109+
# shellcheck disable=SC1091
110+
# shellcheck source=pgtools.conf
110111
source "$CONFIG_FILE"
111112
fi
112113

0 commit comments

Comments
 (0)