AI-Codereview-Gitlab  by sunmh207

GitLab auto code review tool using LLMs

created 8 months ago
595 stars

Top 55.5% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides an automated code review tool leveraging large language models (LLMs) for GitLab and GitHub. It aims to enhance code quality and development efficiency by integrating with CI/CD pipelines, offering instant notifications, and generating development reports. The target audience includes development teams seeking to streamline their code review process.

How It Works

The system is triggered by GitLab webhooks upon code submission (e.g., Merge Requests or Push events). It then utilizes a chosen LLM (DeepSeek, OpenAI, ZhipuAI, Tongyi Qianwen, or Ollama) to analyze the code changes. Review results are posted directly as comments on the relevant Merge Request or Commit, with optional notifications sent to DingTalk, WeChat Work, or Lark.

Quick Start & Requirements

  • Docker:
    • Clone the repository: git clone https://github.com/sunmh207/AI-Codereview-Gitlab.git
    • Copy and edit .env.dist to .env with API keys and configurations.
    • Start services: docker-compose up -d
    • Verify: http://your-server-ip:5001 (API), http://your-server-ip:5002 (Dashboard)
  • Local Python:
    • Clone the repository and cd into it.
    • Install dependencies: pip install -r requirements.txt (Python 3.10+ recommended).
    • Configure environment variables (similar to Docker's .env).
    • Start API: python api.py
    • Start Dashboard: streamlit run ui.py --server.port=5002 --server.address=0.0.0.0
  • GitLab Webhook: Configure a webhook in GitLab project settings pointing to http://your-server-ip:5001/review/webhook, triggering on Push and Merge Request events. A GitLab Access Token is required for authentication.
  • Prerequisites: LLM API keys (e.g., DeepSeek, OpenAI), GitLab Personal or Project Access Token.

Highlighted Details

  • Supports multiple LLM providers including DeepSeek, OpenAI, ZhipuAI, Tongyi Qianwen, and Ollama.
  • Offers customizable review styles: Professional, Sarcastic, Gentlemanly, and Humorous.
  • Provides instant notifications via DingTalk, WeChat Work, or Lark.
  • Includes a dashboard for visualizing review records and project/developer statistics.
  • Features an experimental command-line tool for reviewing entire codebases.

Maintenance & Community

  • The project encourages community contributions via Issues and Pull Requests.
  • Links to WeChat groups are provided for discussion.

Licensing & Compatibility

  • The repository does not explicitly state a license in the README.

Limitations & Caveats

  • The README mentions that the command-line tool for full codebase review is still under development.
  • Network accessibility from GitLab to the deployed server is required.
Health Check
Last commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
10
Issues (30d)
5
Star History
348 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.