2026-02-12 15:46:57 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# Run shellcheck on verification scripts (optional — requires shellcheck to be installed).
|
|
|
|
|
# Usage: bash scripts/verify/run-shellcheck.sh [--optional]
|
2026-03-02 11:37:34 -08:00
|
|
|
# --optional: exit 0 if shellcheck not installed; and do not fail the run on findings (report only).
|
2026-02-12 15:46:57 -08:00
|
|
|
# Install: apt install shellcheck (or brew install shellcheck)
|
|
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
|
cd "$SCRIPT_DIR"
|
|
|
|
|
OPTIONAL=false
|
|
|
|
|
[[ "${1:-}" == "--optional" ]] && OPTIONAL=true
|
|
|
|
|
|
|
|
|
|
if ! command -v shellcheck &>/dev/null; then
|
|
|
|
|
echo "shellcheck not found. Install with: apt install shellcheck (or brew install shellcheck)"
|
|
|
|
|
[[ "$OPTIONAL" == true ]] && exit 0 || exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Running shellcheck on scripts/verify/*.sh..."
|
2026-03-02 11:37:34 -08:00
|
|
|
if [[ "$OPTIONAL" == true ]]; then
|
|
|
|
|
shellcheck -x ./*.sh || true
|
|
|
|
|
echo "Done (optional: exit 0)."
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2026-02-12 15:46:57 -08:00
|
|
|
shellcheck -x ./*.sh
|
|
|
|
|
echo "Done."
|