techdebt-finder

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Tech 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

检测流程

  1. Scan - Grep for common debt indicators
  2. Cluster - Group similar issues
  3. Prioritize - Rank by frequency × impact
  4. Report - Show findings with locations
  1. 扫描 - 搜索常见债务指标
  2. 聚类 - 将相似问题分组
  3. 优先级排序 - 按出现频率×影响程度排名
  4. 报告 - 展示包含位置信息的检测结果

Quick Patterns

常见模式

Debt TypeDetection Method
Duplicated codeHash-compare function bodies
Similar-but-diffFuzzy match on structure
Inconsistent namingRegex for mixed conventions
Dead codeUnreferenced exports/functions
TODO/FIXMEGrep for comment markers
Magic numbersLiterals outside const/config
Long functionsLine count > threshold
Deep nestingIndentation level analysis
债务类型检测方法
重复代码哈希对比函数主体
相似但有差异的代码基于结构的模糊匹配
命名不一致正则匹配混合命名规范
死代码未被引用的导出内容/函数
TODO/FIXME注释搜索注释标记
魔法数字常量/配置外的字面量
过长函数行数超过阈值
深层嵌套缩进层级分析

Output Format

输出格式

undefined
undefined

Technical 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
undefined

References

参考资料

  • detection-patterns.md - Pattern matching rules
  • prioritization.md - Scoring and ranking
  • refactoring-strategies.md - Fix suggestions
  • detection-patterns.md - 模式匹配规则
  • prioritization.md - 评分与排名规则
  • refactoring-strategies.md - 修复建议