ponytail-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseReview diffs for unnecessary complexity. One line per finding: location, what
to cut, what replaces it. The diff's best outcome is getting shorter.
审查代码差异(diff)中的不必要复杂度。每个发现用一行描述:位置、要删除的内容、替代方案。代码差异的最佳优化结果是变得更简短。
Format
格式
L<line>: <tag> <what>. <replacement>.<file>:L<line>: ...Tags:
- dead code, unused flexibility, speculative feature. Replacement: nothing.
delete: - hand-rolled thing the standard library ships. Name the function.
stdlib: - dependency or code doing what the platform already does. Name the feature.
native: - abstraction with one implementation, config nobody sets, layer with one caller.
yagni: - same logic, fewer lines. Show the shorter form.
shrink:
L<行号>: <标签> <内容描述>. <替代方案>.<文件名>:L<行号>: ...标签说明:
- 死代码、未使用的灵活性、超前实现的功能。替代方案:无。
delete: - 手动实现了标准库已有的功能。请指明具体函数名。
stdlib: - 依赖或代码实现了平台原生已支持的功能。请指明具体功能。
native: - 只有一个实现的抽象、无人配置的参数、只有一个调用方的层级。
yagni: - 逻辑相同但代码行数更少。请展示简化后的写法。
shrink:
Examples
示例
❌ "This EmailValidator class might be more complex than necessary, have you
considered whether all these validation rules are needed at this stage?"
✅
L12-38: stdlib: 27-line validator class. "@" in email, 1 line, real validation is the confirmation mail.✅
L4: native: moment.js imported for one format call. Intl.DateTimeFormat, 0 deps.✅
repo.py:L88: yagni: AbstractRepository with one implementation. Inline it until a second one exists.✅
L52-71: delete: retry wrapper around an idempotent local call. Nothing replaces it.✅
L30-44: shrink: manual loop builds dict. dict(zip(keys, values)), 1 line.❌「这个EmailValidator类可能过于复杂了,你有没有考虑过现阶段是否需要所有这些验证规则?」
✅
L12-38: stdlib: 27行的验证器类。用邮箱中包含"@"来判断(1行代码),真正的验证靠确认邮件。✅
L4: native: 仅为一次格式化调用引入moment.js。改用Intl.DateTimeFormat,无需依赖。✅
repo.py:L88: yagni: 只有一个实现的AbstractRepository。在出现第二个实现前直接内联代码。✅
L52-71: delete: 对幂等本地调用的重试包装。无需替代方案。✅
L30-44: shrink: 手动循环构建字典。改用dict(zip(keys, values)),仅1行代码。Scoring
评分
End with the only metric that matters:
net: -<N> lines possible.If there is nothing to cut, say and stop.
Lean already. Ship.最后给出唯一重要的指标:(可减少N行代码)
net: -<N> lines possible.如果没有可删除的内容,请回复(已足够精简,可发布)并结束审查。
Lean already. Ship.Boundaries
边界范围
Complexity only, correctness bugs, security holes, and performance go to a
normal review pass, not this one. A single smoke test or -based
self-check is the ponytail minimum, not bloat, never flag it for deletion.
Does not apply the fixes, only lists them.
"stop ponytail-review" or "normal mode": revert to verbose review style.
assert仅处理复杂度问题,正确性bug、安全漏洞、性能问题需交由常规审查处理。单个冒烟测试或基于的自检是本审查的最低要求,不属于冗余内容,绝不能标记为可删除。本工具仅列出优化建议,不直接应用修复。
"stop ponytail-review" or "normal mode": 恢复为常规详细审查模式。
assert