What is a quality gate?
A quality gate is the best way to enforce a quality policy in your organization. Setting up a quality gate allows you to prevent any code that doesn't pass code reviews from being merged into certain branches.
Key Benefits
Enforce code quality consistency across the entire project
Ensure that new committed code doesn't introduce problems
Ensure issues are addressed before being merged
Before you start
Before proceeding with creating a quality gate in your VCS for your repo, you must create a dedicated Code Reviews connection user for your project.
Enable Gating Code Reviews Settings
To automatically monitor your code with Code Reviews, you need to configure your Code Reviews Settings. You can configure your settings by navigating to the Code Reviews page, select the repository you’d like to enable gating on, then click the gear icon on the right:
In the Settings, navigate to Configuration and ensure the following settings are checked:
Enable Automated Code Reviews on PRs in tracked branches
Publish branch status checks on PRs
Publish a review on PRs in VCS
Allow Code Reviews to act as an approver on PRs
You must also have webhooks created. You can create a webhook by selecting the Create Webhook button.
If you have webhooks already created, your settings will look like this.
You can find out more information about the Code Reviews Settings on this Help Article.
Dedicated Integration User
Please review our Help Article to learn how to set up a dedicated integration user for Code Reviews.
Steps
You can get to branch policy settings with the following:
Project Settings > Repository > Policies > Branch Policies > <Branch Name>.
Suggested Setup
Configure the desired number of reviewers that need to approve your PRs
Example: If all your PRs need to be approved by one of your architects, then configure 2 required reviewers:A good practice is also to "Reset all code reviewer votes when new changes are pushed" to ensure the new code gets reviewed and approved.
Configure the Code Reviews Integration User as "Required Reviewer" to ensure your new code complies with the active Code Reviews' code review criteria configured on your repository.
Note: Code Reviews' code review will Pass if:No issues are detected
Or only WARNING issues (aka non-blocking bugs) are detected.
You can read more about our Severity Levels here.
Example of a PR reviewed by Code Reviews






