Skip to content

CodePolice is an automated code review bot that helps maintain high code quality standards by providing intelligent feedback on pull requests for bitbucket

Notifications You must be signed in to change notification settings

SanthoshSiddegowda/code-police-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodePolice - AI Code Review Bot 👮

CodePolice is an automated code review bot that helps maintain high code quality standards by providing intelligent feedback on pull requests for bitbucket repositories.

Features

  • Automated code reviews using multiple AI models (Deepseek, Anthropic Claude)
  • Integration with Bitbucket pull requests
  • Configurable review criteria
  • Automatic approval/changes requested based on review outcome
  • Support for multiple programming languages

Prerequisites

  • Python 3.8+
  • pip
  • Git
  • Access to Bitbucket API
  • API keys for Deepseek and/or Anthropic

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/codepolice.git
cd codepolice
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file with your credentials:
cp .env.example .env
# Edit .env with your API keys and configuration

Required environment variables:

BITBUCKET_USERNAME=your_username
BITBUCKET_APP_PASSWORD=your_app_password
BITBUCKET_WORKSPACE=your_workspace
BITBUCKET_REPO_SLUG=your_repo_slug

ANTHROPIC_API_KEY=your_anthropic_key

Usage

  1. Start the server:
uvicorn app.main:app --reload
  1. Configure Bitbucket webhook:

    • Go to your repository settings
    • Add webhook pointing to http://your-server/webhook/pull-request
    • Select pull request events
  2. The bot will automatically:

    • Review new pull requests
    • Add comments with feedback
    • Approve or request changes based on the review

Configuration

You can customize the review criteria and behavior by modifying:

  • app/config/constants.py - Review prompts and templates
  • app/services/*_service.py - Service-specific configurations

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

Support

For issues or questions, please contact:

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

CodePolice is an automated code review bot that helps maintain high code quality standards by providing intelligent feedback on pull requests for bitbucket

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages