review-scope
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseReview Scope
评审范围
Overview
概述
Determine the appropriate scope for code review based on change size.
Core principle: Major changes need broader review. Minor changes need focused review.
Question to answer: Is this a minor change or a major change?
根据变更规模确定code review的合适范围。
核心原则: 大型变更需要更全面的评审,小型变更需要针对性评审。
需要明确的问题: 本次变更是小型变更还是大型变更?
Classification
分类
Minor Change
小型变更
Review only NEW code.
Indicators:
| Indicator | Example |
|---|---|
| Few files changed | 1-3 files |
| Isolated change | Single function modification |
| No API changes | Internal implementation only |
| No new dependencies | Uses existing code |
| Localized impact | Doesn't affect other modules |
Examples:
- Bug fix in single function
- Adding a field to existing model
- Small feature in existing module
- Updating constants/config
- Fixing typos
Review scope:
- Changed lines only
- New tests for changes
- Immediate function context
仅评审新增代码。
判定指标:
| 指标 | 示例 |
|---|---|
| 变更文件数量少 | 1-3个文件 |
| 变更独立 | 仅修改单个函数 |
| 无API变更 | 仅修改内部实现 |
| 无新增依赖 | 仅使用现有代码 |
| 影响范围局限 | 不影响其他模块 |
示例:
- 单个函数中的bug修复
- 为现有模型添加字段
- 在现有模块中添加小型功能
- 更新常量/配置
- 修正拼写错误
评审范围:
- 仅变更的代码行
- 针对变更的新增测试
- 函数的直接上下文
Major Change
大型变更
Review NEW code AND IMPACTED code.
Indicators:
| Indicator | Example |
|---|---|
| Many files changed | 4+ files |
| Cross-cutting change | Touches multiple modules |
| API changes | Public interface modified |
| New dependencies | Adds libraries or modules |
| Behavioral changes | Affects existing functionality |
| Architecture impact | Changes patterns or structure |
Examples:
- New feature spanning multiple files
- Refactoring core module
- Changing authentication flow
- Adding new service layer
- Modifying database schema
Review scope:
- All changed code
- All code that calls changed code
- All code that changed code calls
- Integration points
- End-to-end flow
评审新增代码以及受影响的代码。
判定指标:
| 指标 | 示例 |
|---|---|
| 变更文件数量多 | 4个及以上文件 |
| 跨模块变更 | 涉及多个模块 |
| API变更 | 修改了公共接口 |
| 新增依赖 | 添加了库或模块 |
| 行为变更 | 影响现有功能 |
| 架构影响 | 变更了模式或结构 |
示例:
- 跨多个文件的新功能
- 重构核心模块
- 修改认证流程
- 添加新的服务层
- 修改数据库 schema
评审范围:
- 所有变更代码
- 所有调用变更代码的代码
- 所有被变更代码调用的代码
- 集成点
- 端到端流程
Decision Flow
决策流程
┌─────────────────────────────────────┐
│ FILES CHANGED │
└─────────────────┬───────────────────┘
│
▼
┌─────────────────┐
│ > 3 files? │
└────────┬────────┘
│
┌─────────┴─────────┐
│ │
Yes No
│ │
▼ ▼
MAJOR ┌─────────────────┐
│ Public API │
│ changed? │
└────────┬────────┘
│
┌────────┴────────┐
│ │
Yes No
│ │
▼ ▼
MAJOR ┌─────────────────┐
│ Behavioral │
│ change? │
└────────┬────────┘
│
┌────────┴────────┐
│ │
Yes No
│ │
▼ ▼
MAJOR MINOR┌─────────────────────────────────────┐
│ FILES CHANGED │
└─────────────────┬───────────────────┘
│
▼
┌─────────────────┐
│ > 3 files? │
└────────┬────────┘
│
┌─────────┴─────────┐
│ │
Yes No
│ │
▼ ▼
MAJOR ┌─────────────────┐
│ Public API │
│ changed? │
└────────┬────────┘
│
┌────────┴────────┐
│ │
Yes No
│ │
▼ ▼
MAJOR ┌─────────────────┐
│ Behavioral │
│ change? │
└────────┬────────┘
│
┌────────┴────────┐
│ │
Yes No
│ │
▼ ▼
MAJOR MINORFinding Impacted Code
识别受影响代码
For major changes, identify impacted code:
对于大型变更,需要识别受影响的代码:
Find Callers
查找调用方
bash
undefinedbash
undefinedFind all files that import the changed module
Find all files that import the changed module
grep -r "import.from.'./changed-module'" src/
grep -r "import.from.'./changed-module'" src/
Find all usages of changed function
Find all usages of changed function
grep -r "changedFunction" src/
undefinedgrep -r "changedFunction" src/
undefinedFind Dependencies
查找依赖项
bash
undefinedbash
undefinedWhat does the changed code import?
What does the changed code import?
grep "import" src/changed-file.ts
grep "import" src/changed-file.ts
Trace the dependency chain
Trace the dependency chain
undefinedundefinedReview Call Chain
评审调用链
Changed function
│
├── Called by: parentFunction() ← Review this
│ │
│ └── Called by: grandparent() ← Review if behavior changed
│
└── Calls: childFunction() ← Review if inputs changed
│
└── Calls: database.save() ← Review if data shape changedChanged function
│
├── Called by: parentFunction() ← Review this
│ │
│ └── Called by: grandparent() ← Review if behavior changed
│
└── Calls: childFunction() ← Review if inputs changed
│
└── Calls: database.save() ← Review if data shape changedScope Documentation
范围文档
Before starting review, document scope:
开始评审前,记录范围:
Minor Change
小型变更
markdown
undefinedmarkdown
undefinedReview Scope: MINOR
评审范围:小型
Changed files:
- src/utils/format.ts (10 lines)
Review focus:
- New formatDate() function
- Associated tests
Not reviewing:
- Callers of format module (unchanged behavior)
undefined变更文件:
- src/utils/format.ts(10行)
评审重点:
- 新增的formatDate()函数
- 相关测试
不包含的评审内容:
- format模块的调用方(行为未变更)
undefinedMajor Change
大型变更
markdown
undefinedmarkdown
undefinedReview Scope: MAJOR
评审范围:大型
Changed files:
- src/services/auth.ts
- src/middleware/authenticate.ts
- src/routes/login.ts
- src/models/session.ts
- tests/auth.test.ts
Impacted code to review:
- src/routes/protected/* (use auth middleware)
- src/services/user.ts (calls auth service)
Integration points:
- Login flow end-to-end
- Session management
- Protected route access
Review focus:
- All changed code
- All callers of auth service
- Auth middleware consumers
- Session handling throughout
undefined变更文件:
- src/services/auth.ts
- src/middleware/authenticate.ts
- src/routes/login.ts
- src/models/session.ts
- tests/auth.test.ts
需评审的受影响代码:
- src/routes/protected/*(使用auth中间件)
- src/services/user.ts(调用auth服务)
集成点:
- 登录端到端流程
- 会话管理
- 受保护路由访问
评审重点:
- 所有变更代码
- auth服务的所有调用方
- Auth中间件的使用者
- 全流程会话处理
undefinedChecklists by Scope
按范围划分的检查清单
Minor Change Review
小型变更评审
- Changed lines reviewed
- New code meets all 7 criteria
- New tests exist
- Existing tests still pass
- No unintended side effects
- 已评审变更代码行
- 新增代码符合所有7项标准
- 已添加新测试
- 现有测试仍能通过
- 无意外副作用
Major Change Review
大型变更评审
All of minor, PLUS:
- All callers identified
- Caller behavior reviewed
- All callees identified
- Integration points reviewed
- End-to-end flow verified
- Impacted tests reviewed
- No regression in impacted areas
包含所有小型变更检查项,外加:
- 已识别所有调用方
- 已评审调用方行为
- 已识别所有被调用方
- 已评审集成点
- 已验证端到端流程
- 已评审受影响的测试
- 受影响区域无回归问题
Edge Cases
边缘情况
When Uncertain
不确定时
If unsure whether change is minor or major:
Default to major. Better to over-review than miss issues.
若不确定变更属于小型还是大型:
默认按大型变更处理。 过度评审总比遗漏问题要好。
Small Change with Large Impact
影响范围大的小型变更
Sometimes few lines have large impact:
typescript
// Small change, but MAJOR scope
// Changing default timeout affects all HTTP calls
const DEFAULT_TIMEOUT = 30000; // Was 5000Review all code affected by the changed behavior.
有时少量代码变更会产生重大影响:
typescript
// Small change, but MAJOR scope
// Changing default timeout affects all HTTP calls
const DEFAULT_TIMEOUT = 30000; // Was 5000评审所有受该变更行为影响的代码。
Large Refactor with No Behavior Change
无行为变更的大型重构
Many files changed but pure refactor:
typescript
// Renamed variable across 20 files
// No behavior changeStill MAJOR for structural review, but behavioral review is lighter.
变更了多个文件但仅为纯重构:
typescript
// Renamed variable across 20 files
// No behavior change仍需按大型变更进行结构评审,但行为评审可简化。
Integration
集成
This skill is called by:
- - Step 9
issue-driven-development - - Before starting review
comprehensive-review
This skill informs:
- How much code to review
- Which tests to examine
- What integration points to check
本技能被以下内容调用:
- - 第9步
issue-driven-development - - 评审开始前
comprehensive-review
本技能用于指导:
- 需要评审的代码量
- 需要检查的测试项
- 需要验证的集成点