37
PR Review 方法论
PR 多角色审查方法论
为什么需要多角色审查?
单一视角的代码审查容易遗漏问题。通过模拟多个角色的审查,可以更全面地评估代码变更的质量和影响。
Review Roles
1. Product Manager Review
从产品角度审视变更:
- Business Value: Does this deliver promised value?
- User Experience: Will users benefit from this change?
- Strategic Alignment: Does it align with product goals?
- Feature Completeness: Are all requirements met?
- Action: Provide directives for maximum impact
2. Developer Review
从开发者角度审视代码质量:
- Code Quality: Is code clean and maintainable?
- Standards: Does it follow coding conventions?
- Performance: Are there efficiency concerns?
- Scalability: Will it handle growth?
- Refactoring: Any code that needs improvement?
- Action: Suggest specific code improvements
3. Quality Engineer Review
从测试角度审视质量保障:
- Test Coverage: Are all paths tested?
- Edge Cases: Are boundary conditions handled?
- Regression Risk: Could this break existing features?
- Test Quality: Are tests comprehensive and clear?
- Action: Identify missing tests and scenarios
4. Security Engineer Review
从安全角度审视潜在风险:
- Vulnerabilities: Any security risks?
- Data Handling: Is sensitive data protected?
- Authentication: Are auth checks proper?
- Input Validation: Is user input sanitized?
- Compliance: Does it meet security standards?
- Action: Flag security concerns immediately
5. DevOps Review
从运维角度审视部署和监控:
- CI/CD Integration: Will builds succeed?
- Configuration: Are configs properly managed?
- Infrastructure: Any deployment concerns?
- Monitoring: Are metrics and logs adequate?
- Rollback: Can changes be safely reverted?
- Action: Ensure smooth deployment
6. UI/UX Designer Review
从用户体验角度审视界面:
- Visual Consistency: Does it match design system?
- Usability: Is it intuitive to use?
- Accessibility: Is it accessible to all users?
- Responsive: Does it work on all devices?
- Polish: Any rough edges to smooth?
- Action: Ensure delightful user experience
Review Process
标准化的审查流程:
-
Read PR description and linked issues
- 理解变更的背景和目的
-
Review code changes systematically
- 逐文件审查,注意上下文
-
Test functionality locally if applicable
- 实际运行验证功能
-
Consider each perspective above
- 依次用各角色视角审视
-
Leave constructive feedback
- 提供具体、可操作的建议
-
Approve or request changes
- 做出明确的审批决定
Key Principle
Improvements scheduled for "later" must be addressed NOW!
不要让"以后再改"成为技术债务的借口。
实践建议
审查清单模板
## PR Review: [PR Title]
### Product Perspective
- [ ] Business value delivered
- [ ] Requirements met
- [ ] User experience considered
### Developer Perspective
- [ ] Code is clean and readable
- [ ] Follows coding standards
- [ ] No obvious performance issues
### QA Perspective
- [ ] Test coverage adequate
- [ ] Edge cases handled
- [ ] No regression risks
### Security Perspective
- [ ] No security vulnerabilities
- [ ] Input properly validated
- [ ] Sensitive data protected
### DevOps Perspective
- [ ] CI/CD compatible
- [ ] Monitoring in place
- [ ] Rollback possible
### UX Perspective
- [ ] Consistent with design system
- [ ] Accessible
- [ ] Responsive
让 AI 帮助审查
你可以让 AI 从不同角色视角审查代码:
请从以下角色审查这个 PR:
1. 产品经理 - 关注业务价值
2. 安全工程师 - 关注安全风险
3. 测试工程师 - 关注测试覆盖
[粘贴 PR 代码或链接]
下一步
学习 代码分析选项 了解更多代码质量分析技术。