ChatGPT-CodeReview  by anc95

ChatGPT-powered code review bot

created 2 years ago
4,338 stars

Top 11.5% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This project provides an automated code review bot powered by ChatGPT, designed to assist developers by identifying potential issues and suggesting improvements within pull requests. It targets developers and teams seeking to enhance code quality and streamline their review process.

How It Works

The bot integrates with GitHub Actions or can be self-hosted. Upon a new pull request or push event, it analyzes code diffs using the OpenAI API. Users can configure the model, prompt, and specific file patterns to include or ignore, allowing for tailored review experiences.

Quick Start & Requirements

  • GitHub Actions: Add OPENAI_API_KEY to your GitHub Actions secrets and include the anc95/ChatGPT-CodeReview@main action in your .github/workflows/cr.yml.
  • Self-hosting: Clone the repository, copy .env.example to .env and fill in OPENAI_API_KEY, then run npm install, npm run build, and pm2 start pm2.config.cjs.
  • Docker: Build the container with docker build -t cr-bot . and run with docker run -e APP_ID= -e PRIVATE_KEY= cr-bot.
  • Prerequisites: OpenAI API key. Optional configurations include LANGUAGE, OPENAI_API_ENDPOINT, MODEL, PROMPT, top_p, temperature, max_tokens, MAX_PATCH_LENGTH, IGNORE_PATTERNS, INCLUDE_PATTERNS, AZURE_API_VERSION, and AZURE_DEPLOYMENT.

Highlighted Details

  • Supports custom prompts and OpenAI model configurations.
  • Allows filtering files for review using glob or regex patterns.
  • Can be configured to ignore large diffs via MAX_PATCH_LENGTH.
  • Offers multi-language support for review output.

Maintenance & Community

The project is open-source with a contribution guide available. It is inspired by codereview.gpt.

Licensing & Compatibility

Licensed under the ISC license, which is permissive and allows for commercial use and integration with closed-source projects.

Limitations & Caveats

The publicly deployed bot on AWS Lambda has rate limits and may be unstable; self-hosting is recommended for reliable use. The effectiveness of the review is dependent on the quality of the prompt and the capabilities of the chosen OpenAI model.

Health Check
Last commit

3 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
2
Star History
86 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.