feat(ci): add vulture dead code detection (P2 - advisory mode) #259

Closed
xiaoxia wants to merge 3 commits from feat/ci-vulture-dead-code into develop
Owner

概述

在 validate Job 中接入 vulture 死代码检测工具,P2 优先级,告警模式(不阻断 CI)。

vulture 死代码检测(P2 - 告警模式)

  • 置信度阈值:80%(逐步调高)
  • 扫描范围:alembic / apps / packages / scripts
  • 排除:测试文件、迁移文件、文档、node_modules、site-packages
  • 白名单:框架自动调用的代码(FastAPI routes、SQLAlchemy models、Celery tasks、Alembic migrations 等)
  • 模式:告警模式,不阻断合并(先摸清死代码存量,后续逐步清理)

新增文件

  • vulture.conf — vulture 配置文件
  • vulture_whitelist.py — 框架/动态调用代码白名单

修改文件

  • .gitea/workflows/ci-cd.yml — validate Job 新增 Dead code detection 步骤

后续计划

  1. 运行 1-2 周后统计死代码存量
  2. 逐步提高置信度阈值到 90%+
  3. 分批清理确认的死代码
  4. 稳定后考虑改为阻断模式
## 概述 在 validate Job 中接入 vulture 死代码检测工具,P2 优先级,告警模式(不阻断 CI)。 ### vulture 死代码检测(P2 - 告警模式) - **置信度阈值:80%**(逐步调高) - **扫描范围**:`alembic` / `apps` / `packages` / `scripts` - **排除**:测试文件、迁移文件、文档、node_modules、site-packages - **白名单**:框架自动调用的代码(FastAPI routes、SQLAlchemy models、Celery tasks、Alembic migrations 等) - **模式**:告警模式,不阻断合并(先摸清死代码存量,后续逐步清理) ## 新增文件 - `vulture.conf` — vulture 配置文件 - `vulture_whitelist.py` — 框架/动态调用代码白名单 ## 修改文件 - `.gitea/workflows/ci-cd.yml` — validate Job 新增 Dead code detection 步骤 ## 后续计划 1. 运行 1-2 周后统计死代码存量 2. 逐步提高置信度阈值到 90%+ 3. 分批清理确认的死代码 4. 稳定后考虑改为阻断模式
xiaoxia added 3 commits 2026-07-13 15:20:53 +08:00
ci: add vulture dead code detection to validate job
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1560h21m48s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1560h21m50s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 33s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 33s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 24s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1559h50m15s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1559h50m13s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1559h50m11s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1559h50m13s
9d69c71d77
- Add vulture dead code scan step (P2 - advisory mode)
- Confidence threshold: 80%
- Whitelist for framework code (FastAPI, SQLAlchemy, Celery, etc.)
- Exclude tests, migrations, scripts, docs
- Advisory only, does not block CI
xiaoxia added 1 commit 2026-07-13 15:20:54 +08:00
ci: add vulture dead code detection to validate job
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1560h21m48s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1560h21m50s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 33s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 33s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 24s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1559h50m15s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1559h50m13s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1559h50m11s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1559h50m13s
9d69c71d77
- Add vulture dead code scan step (P2 - advisory mode)
- Confidence threshold: 80%
- Whitelist for framework code (FastAPI, SQLAlchemy, Celery, etc.)
- Exclude tests, migrations, scripts, docs
- Advisory only, does not block CI
xiaoxia closed this pull request 2026-07-15 07:39:14 +08:00
Some checks are pending
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1560h21m48s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1560h21m50s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 33s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 33s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 24s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1559h50m15s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1559h50m13s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1559h50m11s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1559h50m13s

Pull request closed

Sign in to join this conversation.