code-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CodeRabbit Code Review

CodeRabbit代码审查

AI-powered code review using CodeRabbit. Enables developers to implement features, review code, and fix issues in autonomous cycles without manual intervention.
使用CodeRabbit的AI驱动代码审查。让开发者能够在无需人工干预的自主循环中实现功能、审查代码并修复问题。

Capabilities

功能特性

  • Finds bugs, security issues, and quality risks in changed code
  • Groups findings by severity (Critical, Warning, Info)
  • Works on staged, committed, or all changes; supports base branch/commit
  • Provides fix suggestions (
    --plain
    ) or minimal output for agents (
    --prompt-only
    )
  • 发现变更代码中的bug、安全问题和质量风险
  • 按严重程度(Critical、Warning、Info)对发现的问题进行分组
  • 支持暂存、已提交或所有变更;支持基准分支/提交
  • 提供修复建议(
    --plain
    )或面向Agent的极简输出(
    --prompt-only

When to Use

使用场景

When user asks to:
  • Review code changes / Review my code
  • Check code quality / Find bugs or security issues
  • Get PR feedback / Pull request review
  • What's wrong with my code / my changes
  • Run coderabbit / Use coderabbit
当用户要求:
  • 审查代码变更 / 审查我的代码
  • 检查代码质量 / 查找bug或安全问题
  • 获取PR反馈 / 拉取请求审查
  • 我的代码/变更有什么问题
  • 运行coderabbit / 使用coderabbit

How to Review

审查步骤

1. Check Prerequisites

1. 检查先决条件

bash
coderabbit --version 2>/dev/null || echo "NOT_INSTALLED"
coderabbit auth status 2>&1
If CLI not installed, tell user:
text
Please install CodeRabbit CLI first:
curl -fsSL https://cli.coderabbit.ai/install.sh | sh
If not authenticated, tell user:
text
Please authenticate first:
coderabbit auth login
bash
coderabbit --version 2>/dev/null || echo "NOT_INSTALLED"
coderabbit auth status 2>&1
如果未安装CLI,告知用户:
text
请先安装CodeRabbit CLI:
curl -fsSL https://cli.coderabbit.ai/install.sh | sh
如果未认证,告知用户:
text
请先进行认证:
coderabbit auth login

2. Run Review

2. 运行审查

Use
--prompt-only
for minimal output optimized for AI agents:
bash
coderabbit review --prompt-only
Or use
--plain
for detailed feedback with fix suggestions:
bash
coderabbit review --plain
Options:
FlagDescription
-t all
All changes (default)
-t committed
Committed changes only
-t uncommitted
Uncommitted changes only
--base main
Compare against specific branch
--base-commit
Compare against specific commit hash
--prompt-only
Minimal output optimized for AI agents
--plain
Detailed feedback with fix suggestions
Shorthand:
cr
is an alias for
coderabbit
:
bash
cr review --prompt-only
使用
--prompt-only
获取面向AI Agent优化的极简输出:
bash
coderabbit review --prompt-only
或者使用
--plain
获取包含修复建议的详细反馈:
bash
coderabbit review --plain
可选参数:
标志描述
-t all
所有变更(默认)
-t committed
仅已提交的变更
-t uncommitted
仅未提交的变更
--base main
与特定分支对比
--base-commit
与特定提交哈希对比
--prompt-only
面向AI Agent优化的极简输出
--plain
包含修复建议的详细反馈
简写:
cr
coderabbit
的别名:
bash
cr review --prompt-only

3. Present Results

3. 展示结果

Group findings by severity:
  1. Critical - Security vulnerabilities, data loss risks, crashes
  2. Warning - Bugs, performance issues, anti-patterns
  3. Info - Style issues, suggestions, minor improvements
Create a task list for issues found that need to be addressed.
按严重程度分组展示结果:
  1. Critical - 安全漏洞、数据丢失风险、崩溃问题
  2. Warning - Bug、性能问题、反模式
  3. Info - 样式问题、建议、小改进
为需要解决的问题创建任务列表。

4. Fix Issues (Autonomous Workflow)

4. 修复问题(自主工作流)

When user requests implementation + review:
  1. Implement the requested feature
  2. Run
    coderabbit review --prompt-only
  3. Create task list from findings
  4. Fix critical and warning issues systematically
  5. Re-run review to verify fixes
  6. Repeat until clean or only info-level issues remain
当用户要求实现+审查时:
  1. 实现所需功能
  2. 运行
    coderabbit review --prompt-only
  3. 根据发现的问题创建任务列表
  4. 系统地修复Critical和Warning级别的问题
  5. 重新运行审查以验证修复
  6. 重复直到无问题或仅剩余Info级别问题

5. Review Specific Changes

5. 审查特定变更

Review only uncommitted changes:
bash
cr review --prompt-only -t uncommitted
Review against a branch:
bash
cr review --prompt-only --base main
Review a specific commit range:
bash
cr review --prompt-only --base-commit abc123
仅审查未提交的变更:
bash
cr review --prompt-only -t uncommitted
与某分支对比审查:
bash
cr review --prompt-only --base main
审查特定提交范围:
bash
cr review --prompt-only --base-commit abc123

Documentation

文档