On this page

OverviewUse the best quality gate configurationQuality gate statusSecurityDefining quality gates

Quality gates


Quality gates enforce a quality policy in your organization by answering one question: is my project ready for release?

To answer this question, you define a set of conditions against which projects are measured. For example:

  • No new blocker issues
  • Code coverage on new code greater than 80%

See the Defining quality gates section below for more information on defining conditions.

Ideally, all projects will use the same quality gate, but that's not always practical. For instance, you may find that:

  • The technological implementation differs from one application to another (you might not require the same code coverage on new code for web applications as you would for Java applications).
  • You want to ensure stronger requirements on some of your applications (internal frameworks for example).

For these reasons, you can define as many quality gates as you need. You can access the Quality Gates page from the top menu. From there, you can define and manage all of your quality gates.

Use the best quality gate configuration

The "Sonar way" quality gate is provided by SonarSource, activated by default, and considered as built-in and read-only. This Quality gate represents the best way to implement the Clean as you code concept by focusing on new code. With each SonarQube release, we automatically adjust this default quality gate according to SonarQube's capabilities.

With the quality gate, you can enforce ratings (reliability, security, security review, and maintainability) based on metrics for overall code and new code. These metrics are part of the default quality gate. Note that while test code quality impacts your quality gate, it's only measured based on the maintainability and reliability metrics. Duplication and security issues are not measured on test code.

You should adjust your quality gates so that they provide clear feedback to developers looking at their project page.

Don't forget that quality gate conditions must use differential values. For example, there's no point in checking an absolute value such as: Number of Lines of Code is greater than 1000.

Recommended quality gate

We recommend the built-in Sonar way quality gate for most projects. It focuses on keeping new code clean, rather than spending a lot of effort remediating old code. Out of the box, it's already set as the default profile.

Quality gate status

The current status is displayed prominently at the top of the Project page:

What your quality gate looks like in SonarQube.

Getting notified when a quality gate fails

Thanks to the notification mechanism, users can be notified when a quality gate fails. To do so, subscribe to the New quality gate status notification either for all projects or a set of projects you're interested in.


Quality gates can be accessed by any user (even anonymous users). All users can view every aspect of a quality gate.

To make changes (create, edit, or delete) to quality gates and quality profiles, users must be granted the Administer Quality Profiles and Gates permission.

A project administrator can choose which quality gates their project is associated with. See Project settings for more details.

Defining quality gates

Each quality gate condition is a combination of:

  • a measure.
  • a comparison operator.
  • an error value.

For instance, a condition might be

  • measure: Blocker issue
  • comparison operator: >
  • error value: 0

Which can be stated as: No blocker issues.

© 2008-2023, SonarSource S.A, Switzerland. Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution-NonCommercial 3.0 United States License. SONARQUBE is a trademark of SonarSource SA. All other trademarks and copyrights are the property of their respective owners.

Creative Commons License