CodePolice is an automated code review bot that helps maintain high code quality standards by providing intelligent feedback on pull requests for bitbucket repositories.
- 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
- Python 3.8+
- pip
- Git
- Access to Bitbucket API
- API keys for Deepseek and/or Anthropic
- Clone the repository:
git clone https://github.com/yourusername/codepolice.git
cd codepolice
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- 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
- Start the server:
uvicorn app.main:app --reload
-
Configure Bitbucket webhook:
- Go to your repository settings
- Add webhook pointing to
http://your-server/webhook/pull-request
- Select pull request events
-
The bot will automatically:
- Review new pull requests
- Add comments with feedback
- Approve or request changes based on the review
You can customize the review criteria and behavior by modifying:
app/config/constants.py
- Review prompts and templatesapp/services/*_service.py
- Service-specific configurations
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
For issues or questions, please contact:
- Email: santoshashgowda@gmail.com
This project is licensed under the MIT License - see the LICENSE file for details.