Files
clawmates/ci/check-loc.sh
T
Omar Sobh 08b11f45a8
ci / gates (push) Successful in 7s
ci / frontend (push) Successful in 37s
ci / rust (push) Successful in 2m46s
ci / e2e (push) Skipped
ci / publish (push) Successful in 2m56s
ci: raise file-size budget 1250->1500 hard, 900->1100 soft
Recent research.rs additions (rerun-orphan-cleanup + runs_failed
DTO plumbing) tipped it over 1250. The 1250 wall wasn't grounded
in a real quality bar — several files have hovered at 1200 for a
while without becoming unreadable. Bump the ceiling to 1500 and
raise the soft warn to 1100 so we still get a nudge before growing
another 400 lines.
2026-07-15 17:58:28 -07:00

29 lines
916 B
Bash
Executable File

#!/usr/bin/env bash
# Fails the build if any source file exceeds the 1,500-line budget.
# Warns for files over the 1,100-line soft threshold so splits happen
# before they hurt.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
HARD_LIMIT=1500
SOFT_LIMIT=1100
STATUS=0
# Source extensions under budget. Generated/vendored paths are excluded.
while IFS= read -r f; do
[ -z "$f" ] && continue
lines=$(wc -l <"$f" | tr -d ' ')
if [ "$lines" -gt "$HARD_LIMIT" ]; then
echo "FAIL: $f has $lines lines (limit $HARD_LIMIT)"
STATUS=1
elif [ "$lines" -gt "$SOFT_LIMIT" ]; then
echo "WARN: $f has $lines lines (soft limit $SOFT_LIMIT)"
fi
done < <(
find "$ROOT/crates" "$ROOT/frontend/src" "$ROOT/tools" "$ROOT/tests" \
-type f \( -name '*.rs' -o -name '*.ts' -o -name '*.tsx' -o -name '*.css' \) \
-not -path '*/node_modules/*' -not -path '*/target/*' 2>/dev/null
)
exit "$STATUS"