基准扩展(文档化):新增测试代码质量维度 25 处(testifylint 20 + thelper 3 + usetesting 2),生产代码 8 处刻意保留不变。新基线 total=33。

Result: {"status":"keep","total_issues":33,"golint_canonicalheader":0,"golint_errname":0,"golint_errorlint":1,"golint_forcetypeassert":0,"golint_gosec":0,"golint_intrange":0,"golint_modernize":3,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":0,"golint_recvcheck":1,"golint_usestdlibvars":0,"golint_wastedassign":0,"golint_total":8,"golint_test_testifylint":20,"golint_test_thelper":3,"golint_test_usetesting":2,"golint_test_total":25,"eslint_problems":0,"eslint_errors":0,"eslint_warnings":0,"tsc_errors":0,"measure_s":37}
This commit is contained in:
ryan
2026-08-16 18:05:44 +08:00
parent 111d2900d7
commit e5f6b0ad90
3 changed files with 22 additions and 1 deletions
+14 -1
View File
@@ -20,6 +20,19 @@ while IFS= read -r line; do
done <<< "$golang_out"
echo "METRIC golint_total=$golang_total"
# ---------- Backend: test-code quality (tests excluded from repo config; safe linters only) ----------
test_out=$(golangci-lint run --tests=true --enable=testifylint,usetesting,thelper --enable-only=testifylint,usetesting,thelper 2>&1 || true)
golang_test_total=0
while IFS= read -r line; do
if [[ "$line" =~ ^\*\ ([a-zA-Z0-9_]+):\ ([0-9]+)$ ]]; then
name="${BASH_REMATCH[1]}"
n="${BASH_REMATCH[2]}"
golang_test_total=$((golang_test_total + n))
echo "METRIC golint_test_${name}=$n"
fi
done <<< "$test_out"
echo "METRIC golint_test_total=$golang_test_total"
# ---------- Frontend: eslint (repo gate) ----------
cd frontend
eslint_out=$(pnpm exec eslint . --max-warnings 0 2>&1 || true)
@@ -37,6 +50,6 @@ tsc_errors=$(grep -cE "error TS" <<< "$tsc_out" || true)
echo "METRIC tsc_errors=$tsc_errors"
end=$(date +%s)
total=$((golang_total + eslint_problems + tsc_errors))
total=$((golang_total + golang_test_total + eslint_problems + tsc_errors))
echo "METRIC total_issues=$total"
echo "METRIC measure_s=$((end - start))"