forked from Timmy_Foundation/the-nexus
enforce: 777-line hard limit on JS files — CI gate + pre-commit hook
app.js is a THIN WRAPPER. No file over 777 lines. Current app.js is 2214 lines — must be broken up before any new features merge. CI will block PRs that violate this. Pre-commit hook catches it locally. Install hook: git config core.hooksPath .githooks
This commit is contained in:
19
.githooks/pre-commit
Executable file
19
.githooks/pre-commit
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pre-commit hook: enforce 777-line limit on JS files
|
||||
# Install: git config core.hooksPath .githooks
|
||||
|
||||
FAIL=0
|
||||
for f in $(git diff --cached --name-only --diff-filter=ACM | grep '\.js$' | grep -v node_modules | grep -v tests/); do
|
||||
LINES=$(wc -l < "$f" | tr -d ' ')
|
||||
if [ "$LINES" -gt 777 ]; then
|
||||
echo "BLOCKED: $f is $LINES lines (max: 777)"
|
||||
echo " Extract into a module. app.js is a thin wrapper."
|
||||
FAIL=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAIL -eq 1 ]; then
|
||||
echo ""
|
||||
echo "No JS file may exceed 777 lines. Break it up."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user