返回 Skill 列表
extension
分类: 开发与工程无需 API Key

refactor-dedupe-and-cleanup

[代码质量]消除代码重复并清理死代码。用于消除复制粘贴的代码,合并相似逻辑,并移除未使用的代码路径。

person作者: jakexiaohubgithub

Refactor: Dedupe and Cleanup

Eliminate redundancy and remove dead code.

Deduplication Patterns

1. Extract Common Method

Move duplicated logic to shared function.

2. Template Method Pattern

Abstract common structure, vary details.

3. Consolidate Conditional Expression

Combine conditions with same result.

Dead Code Removal

Types to Remove

  1. Unreachable code - after return/throw
  2. Unused variables - declared but never read
  3. Unused functions - never called
  4. Commented code - use git history instead
  5. Unused imports - clutters namespace

Safe Removal Process

  1. Search for all references
  2. Check for reflection/dynamic usage
  3. Remove in small commits
  4. Run full test suite