techdebt-finder
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTech Debt Finder
技术债务查找工具
Identify duplicated code, inconsistent patterns, and refactoring opportunities.
识别重复代码、不一致模式以及重构机会。
When to Use
适用场景
- "Find duplicate code"
- "What needs refactoring?"
- "Are there inconsistent patterns?"
- Code review prep
- Pre-refactor analysis
- "查找重复代码"
- "哪些内容需要重构?"
- "是否存在不一致的模式?"
- 代码评审准备
- 重构前分析
Detection Process
检测流程
- Scan - Grep for common debt indicators
- Cluster - Group similar issues
- Prioritize - Rank by frequency × impact
- Report - Show findings with locations
- 扫描 - 搜索常见债务指标
- 聚类 - 将相似问题分组
- 优先级排序 - 按出现频率×影响程度排名
- 报告 - 展示包含位置信息的检测结果
Quick Patterns
常见模式
| Debt Type | Detection Method |
|---|---|
| Duplicated code | Hash-compare function bodies |
| Similar-but-diff | Fuzzy match on structure |
| Inconsistent naming | Regex for mixed conventions |
| Dead code | Unreferenced exports/functions |
| TODO/FIXME | Grep for comment markers |
| Magic numbers | Literals outside const/config |
| Long functions | Line count > threshold |
| Deep nesting | Indentation level analysis |
| 债务类型 | 检测方法 |
|---|---|
| 重复代码 | 哈希对比函数主体 |
| 相似但有差异的代码 | 基于结构的模糊匹配 |
| 命名不一致 | 正则匹配混合命名规范 |
| 死代码 | 未被引用的导出内容/函数 |
| TODO/FIXME注释 | 搜索注释标记 |
| 魔法数字 | 常量/配置外的字面量 |
| 过长函数 | 行数超过阈值 |
| 深层嵌套 | 缩进层级分析 |
Output Format
输出格式
undefinedundefinedTechnical Debt Report
技术债务报告
High Priority (fix soon)
高优先级(尽快修复)
- [DUPLICATE] src/utils/format.ts:23 ↔ src/helpers/fmt.ts:45 Similar: 87% | Impact: High (called 12 places)
- [重复代码] src/utils/format.ts:23 ↔ src/helpers/fmt.ts:45 相似度:87% | 影响程度:高(被调用12次)
Medium Priority (plan for)
中优先级(计划修复)
- [INCONSISTENT] Mixed naming: getUserData vs fetch_user Files: api.ts, service.ts, handler.ts
- [命名不一致] 混合命名:getUserData vs fetch_user 文件:api.ts, service.ts, handler.ts
Low Priority (track)
低优先级(持续跟踪)
- [TODO] 23 TODO comments, oldest: 2023-01-15
undefined- [TODO] 共23条TODO注释,最早的一条:2023-01-15
undefinedReferences
参考资料
- detection-patterns.md - Pattern matching rules
- prioritization.md - Scoring and ranking
- refactoring-strategies.md - Fix suggestions
- detection-patterns.md - 模式匹配规则
- prioritization.md - 评分与排名规则
- refactoring-strategies.md - 修复建议