22 lines
768 B
Bash
22 lines
768 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Run shellcheck on verification scripts (optional — requires shellcheck to be installed).
|
||
|
|
# Usage: bash scripts/verify/run-shellcheck.sh [--optional]
|
||
|
|
# --optional: exit 0 if shellcheck not installed (for CI where shellcheck is optional).
|
||
|
|
# 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..."
|
||
|
|
shellcheck -x ./*.sh
|
||
|
|
echo "Done."
|