AI Code Review Extension
Supercharge Your Code Reviews with OpenAI and Claude AI
Welcome to the AI Code Review Extension – your new ally in building top-notch software! This extension seamlessly integrates OpenAI and Anthropic's Claude powerful language models into your Azure DevOps pipeline, transforming code reviews into an intelligent and efficient process.
Release 2.2.0
- Changed default AI provider to Anthropic (Claude)
- Set claude-3-opus-20240229 as the default model for Anthropic
- Made AI provider and model parameters optional with sensible defaults
- Optimized AI prompt for more concise and focused code reviews
Get Started Now!
Enhance your development workflow with AI Code Review. Start receiving intelligent and actionable insights on your code changes. Install the extension today and experience the future of code reviews!
Why Choose AI Code Review?
- Multiple AI Providers: Choose between OpenAI's GPT models or Anthropic's Claude models for your code reviews.
- Automated Code Reviews: Say goodbye to manual code inspections! Let AI analyze your code changes, catching bugs, performance issues, and suggesting best practices.
- Severity Levels: Review comments include severity levels ([Critical], [High], [Medium], [Low]) to help prioritize issues.
- AI-Powered Insights: Leverage the latest advancements in natural language processing to receive insightful comments on your pull requests.
- Faster Reviews: Reduce the time spent on code reviews. Let AI handle the routine, allowing your team to focus on impactful work.
- Configurable and Customizable: Tailor the extension to your needs with customizable settings. Specify the AI provider and model, define file exclusions, and more.
Prerequisites
- API Key from one of the following providers:
- An Azure DevOps Personal Access Token (PAT) with "Code" and "Pull Request Threads" access
Getting started
Install the AI Code Review DevOps Extension.
Add AI Code Review Task to Your Pipeline:
trigger:
branches:
exclude:
- '*'
pr:
branches:
include:
- '*'
jobs:
- job: CodeReview
pool:
vmImage: 'ubuntu-latest'
steps:
- task: AICodeReview@2
inputs:
api_key: $(AI_ApiKey) # Use appropriate secret variable for AI provider
git_key: $(GIT_PAT) # Use PAT token for Azure DevOps API access
# Optional parameters with defaults (can be omitted):
# ai_provider: 'anthropic' # Default is 'anthropic', alternative is 'openai'
# ai_model: 'claude-3-opus-20240229' # Default for Anthropic
bugs: true # Issues will be marked as [Critical] or [High]
performance: true # Issues will be marked as [High] or [Medium]
best_practices: true # Issues will be marked as [Medium] or [Low]
file_extensions: 'js,ts,css,html'
file_excludes: 'file1.js,file2.py,secret.txt'
additional_prompts: 'Fix variable naming, Ensure consistent indentation, Review error handling approach'`
If you do not already have Build Validation configured for your branch already add Build validation to your branch policy to trigger the code review when a Pull Request is created
FAQ
Q: What is the git_key parameter?
A: The git_key
parameter is a Personal Access Token (PAT) with permissions to create and manage pull request comments. This is used to authenticate with the Azure DevOps API and is separate from the AI provider API key.
Q: How do I create a PAT for the git_key parameter?
A: To create a Personal Access Token:
- Go to your Azure DevOps profile settings
- Select "Personal access tokens"
- Create a new token with "Code (read and write)" and "Pull Request Threads (read and write)" scopes
- Store this token securely as a pipeline variable
Q: What permissions are required for Build Administrators?
A: Build Administrators must be given "Contribute to pull requests" access. Check this Stack Overflow answer for guidance on setting up permissions.

Q: What do the severity levels mean?
A: The AI Code Review tool categorizes issues by severity:
- [Critical]: Serious bugs that could cause crashes, security vulnerabilities, or data loss
- [High]: Important issues that should be fixed, including significant bugs or performance problems
- [Medium]: Issues that should be addressed but aren't urgent, such as moderate performance issues or code structure problems
- [Low]: Minor suggestions for improvement, such as style issues or small optimizations
Release Notes
v2.2.0 - Latest Release
- Changed default AI provider to Anthropic (Claude)
- Set claude-3-opus-20240229 as the default model for Anthropic
- Made AI provider and model parameters optional with sensible defaults
- Optimized AI prompt for more concise and focused code reviews
v2.1.1
- Fixed git authentication for repository operations, resolving issues with accessing private repositories during code review
v2.1.0
- Added separate
git_key
parameter for Azure DevOps API authentication
- Fixed issue with comments being created in resolved state
- Improved AI prompt to focus only on significant issues (bugs, typos, major performance or architecture problems)
- Enhanced comment handling with more accurate checking for "NO_COMMENT" responses
- Added better logging for API authentication issues
Bug Reports
If you find a bug or unexpected behavior, please open a bug report.
Feature Requests
If you have ideas for new features or enhancements, please submit a feature request.
Learn More
Visit our GitHub repository for additional documentation, updates, and support.