forked from Qortal/q-blog
22 lines
618 B
Bash
Executable File
22 lines
618 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Fails if TS suppressions are present. Allow N suppressions via --allow=N.
|
|
set -euo pipefail
|
|
|
|
ALLOW=0
|
|
if [[ "${1-}" =~ --allow=([0-9]+) ]]; then
|
|
ALLOW="${BASHREMATCH[1]}"
|
|
fi
|
|
|
|
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)"
|
|
mapfile -t HITS < <(grep -RIn --exclude-dir=node_modules --exclude-dir=dist --exclude-dir=coverage -E '@ts-nocheck|@ts-ignore' "$ROOT/src" || true)
|
|
|
|
COUNT="${#HITS[@]}"
|
|
echo "Suppressions found: $COUNT (allow <= $ALLOW)"
|
|
printf '%s
|
|
' "${HITS[@]}"
|
|
|
|
if (( COUNT > ALLOW )); then
|
|
echo "ERROR: too many suppressions. Fix or raise the allowance."
|
|
exit 1
|
|
fi
|