mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
refactor: add main.ts decomposition guardrails and extract core helpers
This commit is contained in:
25
scripts/check-main-lines.sh
Executable file
25
scripts/check-main-lines.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
target="${1:-1500}"
|
||||
file="${2:-src/main.ts}"
|
||||
|
||||
if [[ ! -f "$file" ]]; then
|
||||
echo "[ERROR] File not found: $file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ "$target" =~ ^[0-9]+$ ]]; then
|
||||
echo "[ERROR] Target line count must be an integer. Got: $target" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
actual="$(wc -l < "$file" | tr -d ' ')"
|
||||
|
||||
echo "[INFO] $file lines: $actual (target: <= $target)"
|
||||
if (( actual > target )); then
|
||||
echo "[ERROR] Line gate failed: $actual > $target" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[OK] Line gate passed"
|
||||
Reference in New Issue
Block a user