requesting-code-reviews
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRequesting Code Reviews
代码评审请求指南
Quick Start
快速开始
- Self-Review - Review your own diff first, catch obvious issues
- Prepare Code - Tests pass, no debug code, documentation updated
- Write Description - Clear summary, changes list, testing info, screenshots
- Select Reviewers - Match expertise to changes, respect workload
- Time Appropriately - Early week, morning hours, avoid Fridays
- 自我评审 - 先自行检查你的diff,发现明显问题
- 代码准备 - 测试通过,无调试代码,文档已更新
- 撰写描述 - 清晰的摘要、变更列表、测试信息、截图
- 选择评审者 - 根据变更匹配专业能力,尊重工作负载
- 合理安排时间 - 周初、上午时段,避开周五
Features
功能特性
| Feature | Description | Guide |
|---|---|---|
| Self-Review | Catch issues before requesting | Check debug code, TODOs, test coverage |
| PR Description | Guide reviewers effectively | Summary, changes, testing, attention areas |
| Reviewer Selection | Match expertise to needs | Code owner, domain expert, security reviewer |
| PR Sizing | Optimal size for review quality | <400 lines ideal, split larger PRs |
| Timing | When to request reviews | Morning, early week, check availability |
| Reviewer Guidance | Help reviewers focus | Key areas, skip suggestions, questions |
| 特性 | 描述 | 指南 |
|---|---|---|
| 自我评审 | 在请求评审前发现问题 | 检查调试代码、TODO项、测试覆盖率 |
| PR描述 | 有效引导评审者 | 摘要、变更内容、测试信息、重点关注区域 |
| 评审者选择 | 根据需求匹配专业能力 | 代码所有者、领域专家、安全评审人员 |
| PR规模 | 保证评审质量的最优规模 | 理想规模<400行,拆分大型PR |
| 时间安排 | 何时发起评审请求 | 上午、周初,确认评审者可用时间 |
| 评审者引导 | 帮助评审者聚焦重点 | 关键区域、可跳过建议、疑问点 |
Common Patterns
常见模板
undefinedundefinedPR Description Template
PR描述模板
Summary
摘要
[What changed and why - 2-3 sentences]
Resolves #123
[变更内容及原因 - 2-3句话]
Resolves #123
Changes
变更列表
- [Bullet point each significant change]
- [列出每项重要变更]
Testing
测试情况
Automated Tests
自动化测试
- Unit tests added/updated
- Integration tests pass
- 新增/更新单元测试
- 集成测试通过
Manual Testing
手动测试
- [Step to verify]
- [Expected result]
- [验证步骤]
- [预期结果]
Screenshots
截图
[For UI changes]
[适用于UI变更]
Areas Needing Review
需要重点评审的区域
- Security: [specific file/concern]
- Performance: [specific concern]
- 安全:[具体文件/关注点]
- 性能:[具体关注点]
Checklist
检查清单
- Self-review completed
- Tests pass locally
- Documentation updated
undefined- 已完成自我评审
- 本地测试通过
- 文档已更新
undefinedPR Size Guide
PR规模指南
| Size | Lines | Review Time | Recommendation |
|---|---|---|---|
| Small | <100 | 15-30 min | Ideal for quality review |
| Medium | <400 | 30-60 min | Acceptable |
| Large | <800 | 1-2 hours | Consider splitting |
| Too Large | 800+ | 2+ hours | Split required |
| 规模 | 代码行数 | 评审时长 | 建议 |
|---|---|---|---|
| 小型 | <100 | 15-30分钟 | 评审质量最优 |
| 中型 | <400 | 30-60分钟 | 可接受 |
| 大型 | <800 | 1-2小时 | 考虑拆分 |
| 过大 | 800+ | 2小时以上 | 必须拆分 |
Reviewer Selection
评审者选择
- Code owner - maintains affected area
- Domain expert - knows the technology
- Security - for auth/crypto changes
- Architecture - for design changes
Max reviewers: 4 (too many = diffused responsibility)
undefined- 代码所有者 - 负责受影响区域的维护
- 领域专家 - 熟悉相关技术
- 安全人员 - 处理认证/加密相关变更
- 架构师 - 处理设计变更
最多评审者数量:4人(人数过多会分散责任)
undefinedSelf-Review Checklist
自我评审检查清单
[ ] No console.log/debug statements
[ ] No commented-out code
[ ] No hardcoded values (should be config)
[ ] Error handling appropriate
[ ] All tests pass
[ ] New code has tests
[ ] Complex logic has comments
[ ] Commit messages clear
[ ] Rebased on latest main
undefined[ ] 无console.log/调试语句
[ ] 无注释掉的代码
[ ] 无硬编码值(应配置化)
[ ] 错误处理恰当
[ ] 所有测试通过
[ ] 新增代码配有测试
[ ] 复杂逻辑有注释
[ ] 提交信息清晰
[ ] 已基于最新main分支变基
undefinedBest Practices
最佳实践
| Do | Avoid |
|---|---|
| Self-review first | Submitting PRs without testing |
| Keep PRs small (<400 lines) | Creating massive PRs |
| Write clear descriptions | Leaving descriptions empty |
| Highlight key review areas | Expecting reviewers to find everything |
| Choose reviewers wisely | Overloading single reviewers |
| Be responsive to feedback | Ignoring reviewer availability |
| Include screenshots for UI | Rushing reviewers |
| Test thoroughly first | Wasting reviewer time on broken code |
| 建议做法 | 避免事项 |
|---|---|
| 先进行自我评审 | 未测试就提交PR |
| 保持PR规模较小(<400行) | 创建超大PR |
| 撰写清晰的描述 | 留空描述 |
| 突出重点评审区域 | 期望评审者发现所有问题 |
| 明智选择评审者 | 让单个评审者负担过重 |
| 及时回应反馈 | 忽略评审者的可用时间 |
| UI变更附上截图 | 催促评审者 |
| 先充分测试 | 让评审者在有问题的代码上浪费时间 |
Related Skills
相关技能
- - Handle feedback professionally
receiving-code-reviews - - Complete PR preparation
finishing-development-branches - - Pre-submission verification
verifying-before-completion - - Plan review-ready deliverables
writing-plans
- - 专业处理反馈意见
receiving-code-reviews - - 完成PR准备工作
finishing-development-branches - - 提交前验证
verifying-before-completion - - 规划可评审的交付物
writing-plans