clawdinators/scripts/lint-shell.sh
joshp123 52f5168cd2 Add shellcheck + shfmt linting for scripts
Add CI workflow to run shellcheck + shfmt, plus a scripts/lint-shell.sh helper.

Also apply shfmt formatting and fix initial shellcheck warnings.
2026-02-15 15:51:40 -08:00

21 lines
485 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Lint/format gate for repo shell scripts.
# - shellcheck: static analysis
# - shfmt: formatting
# Find shell scripts we own (keep it explicit/simple).
mapfile -t files < <(find scripts -type f -name '*.sh' -print | sort)
if [ "${#files[@]}" -eq 0 ]; then
echo "no shell scripts found" >&2
exit 0
fi
echo "shellcheck (${#files[@]} files)" >&2
shellcheck -S warning "${files[@]}"
echo "shfmt check" >&2
shfmt -i 2 -ci -sr -d "${files[@]}"