网淘吧来吧,欢迎您!

Receiving Code Review技能使用说明

2026-03-29 新闻来源:网淘吧 围观:11
电脑广告
手机广告

代码审查的接收

概述

代码审查需要技术评估,而非情感表演。

核心原则:实施前先验证。假设前先提问。技术正确性高于社交舒适度。

Receiving Code Review

回应模式

WHEN receiving code review feedback:

1. READ: Complete feedback without reacting
2. UNDERSTAND: Restate requirement in own words (or ask)
3. VERIFY: Check against codebase reality
4. EVALUATE: Technically sound for THIS codebase?
5. RESPOND: Technical acknowledgment or reasoned pushback
6. IMPLEMENT: One item at a time, test each

禁止的回应

切勿:

  • “您说得完全正确!”(明确违反CLAUDE.md)
  • “好观点!”/“反馈太棒了!”(表演性回应)
  • “我现在就实施这个”(在验证之前)

替代做法:

  • 重述技术要求
  • 提出澄清性问题
  • 如果错误,用技术推理进行反驳
  • 直接开始工作(行动胜于言语)

处理不明确的反馈

IF any item is unclear:
  STOP - do not implement anything yet
  ASK for clarification on unclear items

WHY: Items may be related. Partial understanding = wrong implementation.

示例:

your human partner: "Fix 1-6"
You understand 1,2,3,6. Unclear on 4,5.

❌ WRONG: Implement 1,2,3,6 now, ask about 4,5 later
✅ RIGHT: "I understand items 1,2,3,6. Need clarification on 4 and 5 before proceeding."

来源特定处理

来自您的人类伙伴

  • 信任- 理解后再实施
  • 仍要询问若范围不明确
  • 不进行形式化同意
  • 直接行动或技术性确认

来自外部评审者

BEFORE implementing:
  1. Check: Technically correct for THIS codebase?
  2. Check: Breaks existing functionality?
  3. Check: Reason for current implementation?
  4. Check: Works on all platforms/versions?
  5. Check: Does reviewer understand full context?

IF suggestion seems wrong:
  Push back with technical reasoning

IF can't easily verify:
  Say so: "I can't verify this without [X]. Should I [investigate/ask/proceed]?"

IF conflicts with your human partner's prior decisions:
  Stop and discuss with your human partner first

你人类伙伴的规则:“外部反馈——保持怀疑,但仔细检查”

为“专业”功能进行YAGNI检查

IF reviewer suggests "implementing properly":
  grep codebase for actual usage

  IF unused: "This endpoint isn't called. Remove it (YAGNI)?"
  IF used: Then implement properly

你人类伙伴的规则:“你和评审者都向我汇报。如果我们不需要这个功能,就不要添加。”

实施顺序

FOR multi-item feedback:
  1. Clarify anything unclear FIRST
  2. Then implement in this order:
     - Blocking issues (breaks, security)
     - Simple fixes (typos, imports)
     - Complex fixes (refactoring, logic)
  3. Test each fix individually
  4. Verify no regressions

何时提出异议

在以下情况提出异议:

  • 建议破坏了现有功能
  • 评审者缺乏完整背景信息
  • 违反YAGNI原则(无用功能)
  • 技术上不适合当前技术栈
  • 存在遗留/兼容性原因
  • 与你人类伙伴的架构决策相冲突

如何提出异议:

  • 运用技术推理,而非防御性态度
  • 提出具体问题
  • 引用有效的测试/代码
  • 若涉及架构问题,请与你的搭档沟通

若不便直接提出异议,可发出信号:"Circle K便利店有怪事发生"

接受正确反馈

当反馈确实正确时:

✅ "Fixed. [Brief description of what changed]"
✅ "Good catch - [specific issue]. Fixed in [location]."
✅ [Just fix it and show in the code]

❌ "You're absolutely right!"
❌ "Great point!"
❌ "Thanks for catching that!"
❌ "Thanks for [anything]"
❌ ANY gratitude expression

为何不必致谢:行动胜于言辞。直接修正即可。代码本身就能证明你已听取反馈。

若发现自己正要写下"谢谢":删除它。直接说明修正内容。

优雅地修正你的异议

若你提出异议但最终发现自己是错的:

✅ "You were right - I checked [X] and it does [Y]. Implementing now."
✅ "Verified this and you're correct. My initial understanding was wrong because [reason]. Fixing."

❌ Long apology
❌ Defending why you pushed back
❌ Over-explaining

客观陈述修正内容并继续推进。

常见错误

错误修正方法
形式化的附和陈述要求或直接行动
盲目实施先对照代码库进行验证
未经测试就批量处理逐一测试每个项目
假设评审者是正确的检查是否会破坏现有功能
避免抵触技术正确性高于舒适度
部分实施首先澄清所有事项
无法验证,但仍继续说明局限性,寻求方向

实际示例

表面同意(不好):

Reviewer: "Remove legacy code"
❌ "You're absolutely right! Let me remove that..."

技术验证(好):

Reviewer: "Remove legacy code"
✅ "Checking... build target is 10.15+, this API needs 13+. Need legacy for backward compat. Current impl has wrong bundle ID - fix it or drop pre-13 support?"

YAGNI(好):

Reviewer: "Implement proper metrics tracking with database, date filters, CSV export"
✅ "Grepped codebase - nothing calls this endpoint. Remove it (YAGNI)? Or is there usage I'm missing?"

不明确事项(好):

your human partner: "Fix items 1-6"
You understand 1,2,3,6. Unclear on 4,5.
✅ "Understand 1,2,3,6. Need clarification on 4 and 5 before implementing."

GitHub 线程回复

在回复 GitHub 上的内联评审评论时,请在评论线程中回复(gh api repos/{所有者}/{仓库}/pulls/{拉取请求}/comments/{评论ID}/replies),而不是作为顶层的拉取请求评论。

底线

外部反馈是需要评估的建议,而非必须执行的指令。

先验证,再质疑,而后落实。

不搞形式化附和,技术严谨性始终如一。

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏
文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第326346名访客 今日有221篇新文章/评论