From 03a5285b91af84569266dc5f1a13d7a3b21fa112 Mon Sep 17 00:00:00 2001 From: Loom Worker Date: Mon, 26 Jan 2026 20:32:19 -0800 Subject: [PATCH] Add shellcheck linting workflow and configuration - Add .shellcheckrc with bash 3.2 target and SC1090/SC1091 disabled - Add .github/workflows/shellcheck.yml CI job - Workflow runs on push/PR for .loom/scripts/**/*.sh files - Uses --severity=warning threshold for strict validation Implements Phase 1 of #1365 (shellcheck integration) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/shellcheck.yml | 39 ++++++++++++++++++++++++++++++++ .shellcheckrc | 18 +++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/shellcheck.yml create mode 100644 .shellcheckrc diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000000..375aa75d26 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,39 @@ +name: Shell Script Linting + +on: + push: + branches: [main] + paths: + - '.loom/scripts/**/*.sh' + - '.shellcheckrc' + - '.github/workflows/shellcheck.yml' + pull_request: + branches: [main] + paths: + - '.loom/scripts/**/*.sh' + - '.shellcheckrc' + - '.github/workflows/shellcheck.yml' + +jobs: + shellcheck: + name: Shellcheck Validation + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install shellcheck + run: | + sudo apt-get update + sudo apt-get install -y shellcheck + + - name: Run shellcheck + run: | + echo "Running shellcheck on all shell scripts in .loom/scripts/" + find .loom/scripts -type f -name "*.sh" -print0 | \ + xargs -0 shellcheck --severity=warning --shell=bash + + - name: Verify all scripts passed + run: | + echo "✅ All shell scripts passed shellcheck validation" diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000000..439dfe1776 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,18 @@ +# Shellcheck configuration for Loom repository +# +# Target bash 3.2 for macOS compatibility +# See: https://github.com/koalaman/shellcheck/wiki/SC1090 + +# Specify shell dialect +shell=bash + +# Disable specific rules that don't apply to our use case + +# SC1090: Can't follow non-constant source +# We use dynamic sourcing patterns (e.g., source "${SCRIPT_DIR}/common.sh") +# which shellcheck can't statically analyze +disable=SC1090 + +# SC1091: Not following: file not found +# Similar to SC1090 - we source files that may not exist at check time +disable=SC1091