From ab3fe2f603698774f8da416625756b114f78fec8 Mon Sep 17 00:00:00 2001 From: Droid Date: Mon, 31 Aug 2026 17:07:54 +0000 Subject: [PATCH] fix(scripts): split rendered declaration in lint_zsh_template Split the local rendered declaration from its assignment in lint_zsh_template() so a failed $(basename ...) command substitution is not masked by local's always-zero exit status. This resolves shellcheck SC2155 without changing the rendered path or lint behavior. Fixes #167 --- scripts/lint-shell-templates.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/lint-shell-templates.sh b/scripts/lint-shell-templates.sh index 8c87606..522f354 100755 --- a/scripts/lint-shell-templates.sh +++ b/scripts/lint-shell-templates.sh @@ -72,7 +72,11 @@ lint_sh_template() { # Lint a rendered zsh template with zsh -n (shellcheck does not support zsh). lint_zsh_template() { local tmpl="$1" - local rendered="$tmpdir/$(basename "$tmpl" .tmpl)" + # Declare and assign separately so a failed command substitution in the + # assignment is not masked by `local`'s always-zero exit status + # (shellcheck SC2155). + local rendered + rendered="$tmpdir/$(basename "$tmpl" .tmpl)" echo "=== $tmpl (zsh) ===" render_template "$tmpl" > "$rendered" if command -v zsh >/dev/null 2>&1; then