跳到主要内容

AI Code Review

AI Code Review is the intelligent code review capability provided by the AtomGit platform. After a merge request is created, you can input an AI code review command, and in a few minutes, the AI will automatically complete the code analysis, generate a review summary, identify issues, and provide actionable code suggestions, making each merge safer and more efficient.

Core Value:

  • Minute-Level Automatic Review: Trigger AI intervention via commands after a merge request is created
  • Actionable Code Suggestions: Not only point out issues, but also generate code modifications that can be directly submitted; click "Apply Suggestion" to fix
  • Intelligent Review Summary: Automatically generate change summaries to quickly understand the scope of changes and risk level
  • Security and Quality Protection: Automatically detect security vulnerabilities, code smells, and deviations from best practices

1. How It Works

Process Explanation:

  1. Create Merge Request: Developers submit code changes and create a merge request
  2. AI Automatic Review: After the webhook is triggered, the AI completes the code analysis within a few minutes
  3. Publish Review Results: The AI posts review comments in the merge request, including summary, issues, and suggestions
  4. Apply Suggestions: Developers view the suggestions and click "Apply Suggestion" to directly submit code fixes

2. Core Capabilities

2.1 Automatic Review Summary

After a merge request is created, the AI automatically generates a change summary, including:

  • Number of files and lines changed
  • Analysis of the scope and impact of the changes
  • Risk level assessment
  • Key points to focus on

2.2 Code Issue Detection

The AI automatically detects the following types of issues:

CategoryDescriptionExample
Security RisksCode that may cause security vulnerabilitiesStoring passwords in plaintext, SQL injection, hard-coded keys
Logic DefectsCode that may cause runtime errorsNull pointer references, resource leaks, race conditions
Code QualityCode that does not follow best practicesOverly long functions, duplicate code, non-standard naming
Performance IssuesCode that may affect performanceN+1 queries, unnecessary loops, memory waste

2.3 Actionable Code Suggestions

The AI not only identifies issues but also provides code modification suggestions that can be directly submitted:

  • Suggestions are presented in code diff format, clearly marking the modified content
  • Developers can click "Apply Suggestion" to directly submit the fix
  • After applying suggestions, the AI updates the review status

2.4 Interactive Review

In addition to automatic reviews, developers can actively request AI assistance through commands within the merge request.


3. Command Reference

In the comment section of a merge request, use the following commands to interact with the AI.

3.1 Command List

CommandDescriptionUse Case
/ai reviewImmediately perform a full review of the current merge request (refresh comments)Need to re-review, or manually trigger when automatic review doesn't trigger
/ai summaryGenerate only the merge request summary, without re-reviewingQuickly understand the scope of changes, without a full review
/ai explainExplain a piece of code or commentDon't understand the AI's review suggestions, or want to know the meaning of a specific code snippet
/ai helpDisplay all available commandsCheck help when forgetting command usage
@atomgit-botDirectly ask questions in comments, AI will replyInteract with AI for specific questions, such as "Does this function have concurrency issues?"

3.2 Usage Method

  1. Go to the merge request page of a repository that has enabled AI review
  2. Enter a command (e.g., /ai review) or mention (@atomgit-bot) in the comment section
  3. The AI will respond with review results or answer questions within a few minutes

4. Experience Guide

AI Code Review is currently in the VIP Preview Phase, and access is limited to a whitelist mechanism. Currently, it only supports public repositories.

4.1 Activation Process

If your organization or repository has not yet activated AI Code Review, contact the AtomGit official team to apply.

Step-by-step Explanation:

  1. Contact AtomGit Official: Apply for AI Code Review activation with the AtomGit official team
  2. Provide Information: Inform the organization name or repository path that needs to enable the review, for example:
    • Organization: openeuler
    • Repository: openeuler/kernel, cann/ops-nn
  3. Official Configuration: The AtomGit official team will add the organization/repository to the whitelist and configure the Webhook Token
  4. Start Experience: After configuration, create a merge request in the activated repository and use commands to interact with AI to trigger AI review

To activate AI Code Review for your organization or repository, please contact the AtomGit official team.

4.2 Usage Restrictions

  • AI Code Review currently supports only public repositories
  • Private repository support is under planning and will be gradually opened

5. Enterprise Edition Configuration

Enterprise administrators can manage the AI Code Review feature in enterprise settings.

5.1 Access Location

Go to Enterprise SettingsAI Code Review to view and manage AI Code Review configurations.

5.2 Configuration Instructions

Configuration ItemDescription
Enable StatusEnable or disable the AI Code Review feature for the enterprise
Repository ScopeSpecify which repositories enable AI Code Review
Review ScopeSet which types of merge requests to review (e.g., MRs exceeding a certain number of lines)

Specific configuration options for enterprise features may vary by version. Please refer to the actual interface.


6. Review Result Explanation

6.1 Review Comment Structure

The AI's review comments posted in the merge request include the following parts:

Review Summary
├── Change Scope (number of files, lines of code)
├── Risk Level Assessment
└── Key Points to Focus On

Code Issues (sorted by severity)
├── Security Risks
├── Logic Defects
├── Code Quality
└── Performance Issues

Code Suggestions (actionable)
└── Code Diff Format Presentation

Review Conclusion
└── Overall Evaluation and Merge Recommendation

6.2 Apply Code Suggestions

When the AI provides code modification suggestions:

  1. View the suggested code diff and confirm the changes
  2. Click the "Apply Suggestion" button, and the AI will automatically submit the fix
  3. After applying the suggestion, the review status will be updated

7. Contact Us

If you encounter any issues during use or have feedback and suggestions, please contact us through the official customer service channels (online chat, customer service email: kefu@gitcode.com, customer service hotline: 4006868951).


8. Frequently Asked Questions

Q1: How long does AI review take?

Typically, the review is completed within 3-5 minutes after the merge request is created. Large merge requests (over 1000 lines of changes) may take longer.

Q2: Are the AI review results accurate?

AI review is based on large language models and can detect most common code issues. However, AI may produce false positives or miss some issues. It is recommended to use AI review as an auxiliary tool, and still conduct manual review for final verification.

Q3: Does AI review support private repositories?

Currently, AI Code Review only supports public repositories and does not support private repositories. Private repository support will be gradually added later.

Q4: Can I disable AI review for a specific repository?

Yes. Contact AtomGit official to remove the corresponding repository's Webhook configuration to disable it. After disabling, merge requests in the repository will no longer trigger AI review. In the enterprise edition, you can disable it yourself.

Q5: Which programming languages does AI review support?

It currently supports mainstream programming languages, including C/C++, Go, Python, Java, JavaScript/TypeScript, Rust, etc. For less common languages, AI can still provide basic code quality analysis.