dead-code

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dead Code Detection

死代码检测

Find unused functions and dead code using TLDR static analysis.
使用TLDR静态分析查找未使用的函数和死代码。

Quick Start

快速开始

bash
undefined
bash
undefined

Scan entire project

Scan entire project

tldr dead .
tldr dead .

Scan specific directory

Scan specific directory

tldr dead src/
tldr dead src/

Specify entry points (functions to exclude from analysis)

Specify entry points (functions to exclude from analysis)

tldr dead . --entry main cli test_
tldr dead . --entry main cli test_

Specify language

Specify language

tldr dead . --lang python tldr dead . --lang typescript
undefined
tldr dead . --lang python tldr dead . --lang typescript
undefined

Output Format

输出格式

Dead code analysis:
  Total functions: 150
  Dead functions: 12

Unused functions:
  - old_helper (src/utils.py:42)
  - deprecated_func (src/legacy.py:15)
  - _unused_method (src/api.py:230)
Dead code analysis:
  Total functions: 150
  Dead functions: 12

Unused functions:
  - old_helper (src/utils.py:42)
  - deprecated_func (src/legacy.py:15)
  - _unused_method (src/api.py:230)

Cross-Platform

跨平台支持

Works on Windows, Mac, and Linux (including WSL).
bash
undefined
支持在Windows、Mac和Linux(包括WSL)系统上运行。
bash
undefined

Windows (PowerShell)

Windows (PowerShell)

tldr dead .
tldr dead .

Mac/Linux

Mac/Linux

tldr dead .
undefined
tldr dead .
undefined

Entry Points

入口点

Functions matching entry patterns are excluded from dead code analysis:
  • main
    ,
    cli
    - Application entry points
  • test_*
    ,
    *_test
    - Test functions
  • setup
    ,
    teardown
    - Fixtures
  • @app.route
    ,
    @api.endpoint
    - Framework handlers
bash
undefined
匹配入口点模式的函数将被排除在死代码分析之外:
  • main
    ,
    cli
    - 应用程序入口点
  • test_*
    ,
    *_test
    - 测试函数
  • setup
    ,
    teardown
    - 测试夹具
  • @app.route
    ,
    @api.endpoint
    - 框架处理器
bash
undefined

Custom entry points

Custom entry points

tldr dead src/ --entry main api_handler background_job
undefined
tldr dead src/ --entry main api_handler background_job
undefined

Integration

集成方式

This skill replaces the session-start-dead-code hook with on-demand analysis.
ApproachProsCons
Hook (removed)AutomaticSlowed startup by 3s
Skill (this)On-demand, fastManual invocation
本技能将session-start-dead-code钩子替换为按需分析。
实现方式优点缺点
钩子(已移除)自动执行启动速度减慢3秒
本技能按需执行、速度快需手动调用

Related Commands

相关命令

bash
undefined
bash
undefined

Impact analysis (who calls this?)

Impact analysis (who calls this?)

tldr impact func_name .
tldr impact func_name .

Architecture layers

Architecture layers

tldr arch src/
tldr arch src/

Full codebase structure

Full codebase structure

tldr structure . --lang python
undefined
tldr structure . --lang python
undefined