pr-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PR Review

PR审查

Review the current Pull Request that has been checked out locally.
对本地已检出的当前Pull Request进行审查。

Instructions

操作步骤

  1. ** Prerequisite **
    • Run
      git fetch origin master
      to ensure we have the latest main branch
  2. Get the PR changes
    • Run
      git diff $(git merge-base HEAD origin/master)..HEAD
      to see all changes
    • If master doesn't exist, try origin/main
    • Run
      git log --oneline $(git merge-base HEAD origin/main)..HEAD
      to see commit messages
  3. Understand the context
    • Examine the changed files to understand the PR's purpose
    • Look for any related documentation or comments
  4. Provide a structured code review

    Summary

    • Brief overview of what this PR accomplishes
    • Number of files changed and scope

    Code Quality

    • Code organization and structure
    • Readability and maintainability
    • Adherence to best practices
    • Error handling

    Potential Issues

    • Bugs or logic errors
    • Unhandled edge cases
    • Performance concerns
    • Security vulnerabilities
    • Concurrency issues

    Testing

    • Adequacy of tests
    • Whether existing tests are updated
    • Suggested additional test cases

    Documentation

    • Clarity of code comments
    • Updated documentation (README, API docs)
    • Explanation of complex logic

    Suggestions

    • Specific improvements with code examples
    • Refactoring opportunities
    • Alternative approaches
  5. Output Format
    • Use markdown formatting
    • Make it ready to paste into a Bitbucket PR comment
    • Be constructive and educational
    • Praise good practices while noting issues
  1. 前置条件
    • 运行
      git fetch origin master
      以确保获取最新的主分支
    • 如果master分支不存在,尝试使用origin/main
  2. 获取PR变更内容
    • 运行
      git diff $(git merge-base HEAD origin/master)..HEAD
      查看所有变更
    • 如果master不存在,尝试origin/main
    • 运行
      git log --oneline $(git merge-base HEAD origin/main)..HEAD
      查看提交信息
  3. 理解上下文
    • 检查变更文件以理解该PR的目的
    • 查找相关的文档或注释
  4. 提供结构化的代码审查

    总结

    • 简要概述该PR实现的功能
    • 变更文件数量及影响范围

    代码质量

    • 代码组织与结构
    • 可读性与可维护性
    • 对最佳实践的遵循情况
    • 错误处理机制

    潜在问题

    • 漏洞或逻辑错误
    • 未处理的边缘情况
    • 性能问题
    • 安全漏洞
    • 并发问题

    测试情况

    • 测试的充分性
    • 现有测试是否已更新
    • 建议补充的测试用例

    文档情况

    • 代码注释的清晰度
    • 是否已更新相关文档(README、API文档等)
    • 复杂逻辑的说明情况

    改进建议

    • 附带代码示例的具体改进方案
    • 重构机会
    • 替代实现方案
  5. 输出格式
    • 使用Markdown格式
    • 内容需可直接粘贴到Bitbucket PR评论中
    • 反馈需具有建设性和指导性
    • 在指出问题的同时,也要认可好的实践