File size: 850 Bytes
3be03dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# check_file_sizes.sh — fails CI if any source file exceeds 500 lines
# Usage: bash scripts/check_file_sizes.sh

set -euo pipefail

MAX_LINES=500
FAILED=0

while IFS= read -r -d '' file; do
  lines=$(wc -l < "$file")
  if [[ $lines -gt $MAX_LINES ]]; then
    echo "FAIL: $file has $lines lines (limit: $MAX_LINES)"
    FAILED=1
  fi
done < <(find . \
  \( -name "*.py" -o -name "*.tsx" -o -name "*.jsx" -o -name "*.ts" \) \
  -not -path "./.git/*" \
  -not -path "./node_modules/*" \
  -not -path "./.next/*" \
  -not -path "./__pycache__/*" \
  -not -name "ml_pipeline.py" \
  -not -name "ml_status.py" \
  -print0)

if [[ $FAILED -eq 1 ]]; then
  echo ""
  echo "One or more files exceed the $MAX_LINES-line limit."
  echo "Split large files into focused modules."
  exit 1
fi

echo "All files within $MAX_LINES-line limit."