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