mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-04 00:15:28 +08:00
Merge pull request #96 from CJackHwang/codex/update-ci-line-count-limits-cihke3
ci: ignore test files in line gate and raise frontend limit to 500
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# Line gate targets for large-file decoupling refactor.
|
||||
# Default limit: 300 lines
|
||||
# Backend default limit: 300 lines
|
||||
# Frontend (webui/) default limit: 500 lines
|
||||
# Entry/facade limit: 120 lines (enforced in script)
|
||||
# Test files are ignored by the gate script.
|
||||
|
||||
internal/config/config.go
|
||||
internal/config/logger.go
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
## Rules
|
||||
|
||||
1. Production file default upper bound: `<= 300` lines.
|
||||
2. Entry/facade files upper bound: `<= 120` lines.
|
||||
3. Scope is limited to target files in `plans/refactor-line-gate-targets.txt`.
|
||||
4. Test files are out of scope for this gate.
|
||||
1. Backend production files upper bound: `<= 300` lines.
|
||||
2. Frontend (`webui/`) production files upper bound: `<= 500` lines.
|
||||
3. Entry/facade files upper bound: `<= 120` lines.
|
||||
4. Scope is limited to target files in `plans/refactor-line-gate-targets.txt`.
|
||||
5. Test files are out of scope for this gate.
|
||||
|
||||
## Command
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
TARGETS_FILE="$ROOT_DIR/plans/refactor-line-gate-targets.txt"
|
||||
|
||||
DEFAULT_MAX=300
|
||||
FRONTEND_MAX=500
|
||||
ENTRY_MAX=120
|
||||
|
||||
is_entry_file() {
|
||||
@@ -22,6 +23,27 @@ is_entry_file() {
|
||||
return 1
|
||||
}
|
||||
|
||||
is_frontend_file() {
|
||||
[[ "$1" == webui/* ]]
|
||||
}
|
||||
|
||||
is_test_file() {
|
||||
local file="$1"
|
||||
local base
|
||||
base="$(basename "$file")"
|
||||
|
||||
[[ "$file" == tests/* ]] && return 0
|
||||
[[ "$file" == */tests/* ]] && return 0
|
||||
[[ "$file" == */__tests__/* ]] && return 0
|
||||
[[ "$base" == *_test.go ]] && return 0
|
||||
[[ "$base" == *.test.js ]] && return 0
|
||||
[[ "$base" == *.test.jsx ]] && return 0
|
||||
[[ "$base" == *.test.ts ]] && return 0
|
||||
[[ "$base" == *.test.tsx ]] && return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
if [[ ! -f "$TARGETS_FILE" ]]; then
|
||||
echo "missing targets file: $TARGETS_FILE" >&2
|
||||
exit 1
|
||||
@@ -35,6 +57,10 @@ while IFS= read -r file; do
|
||||
[[ -z "$file" ]] && continue
|
||||
[[ "${file:0:1}" == "#" ]] && continue
|
||||
|
||||
if is_test_file "$file"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
checked=$((checked + 1))
|
||||
abs="$ROOT_DIR/$file"
|
||||
if [[ ! -f "$abs" ]]; then
|
||||
@@ -47,6 +73,8 @@ while IFS= read -r file; do
|
||||
limit="$DEFAULT_MAX"
|
||||
if is_entry_file "$file"; then
|
||||
limit="$ENTRY_MAX"
|
||||
elif is_frontend_file "$file"; then
|
||||
limit="$FRONTEND_MAX"
|
||||
fi
|
||||
|
||||
if (( lines > limit )); then
|
||||
|
||||
Reference in New Issue
Block a user