Start FreeLog in
SonarQube Cloud | Improving your code | Quality gates

Quality gates

On this page

A quality gate is an indicator that tells you whether your code meets the minimum level of quality required for your project. It consists of a set of conditions that are applied to the results of each code analysis and review. If the analysis results meet or exceed the quality gate conditions then it shows a Passed status otherwise, it shows a Failed status. For more information, see Understanding quality gates.

Quality gates appear with analysis results

Quality gates are displayed in the SonarQube Cloud interface along with the code review and analysis results of the main branch of the project, other non-main branches, and pull requests.

For pull requests, the quality gate will also be displayed in the repository platform as a pull request decoration.

The quality gates will indicate a Passed or Failed status (or if not properly set up, a Not Computed status, see below)

For example, go to Main Branch > Summary > Quality Gate; here you can see the quality gate for the main branch of a project with a Passed status:

Main branch summary

If you are using the SonarQube for IDE IDE extension, changes to your main branch quality gate will also appear as notifications in your IDE (this only works if you have configured SonarQube for IDE to connect to your SonarQube Cloud account).

When is a quality gate not computed?

There are two main reasons why the quality gate may not be computed:

  • You have performed only one analysis on your code (the quality gate is computed after the second analysis).
  • No new code definition is set up for the project.
    This may only occur for projects created a long time ago since in the current version of SonarQube Server you cannot create a new project without setting up the new code definition. 

If the quality gate has not been computed then the Not computed message is displayed in the place where the quality gate status usually appears as illustrated below. 

Banner when the quality gate has not been computed.

The Set New Code Definition button is displayed as well in case no new code definition is set up. To fix this, click the button. For more details on setting up the definition, see About new code page.

How quality gates are used

The purpose of the quality gate is to tell you whether your code is good enough to be pushed to the next step:

  • For the main branch and other long-lived branches, the quality gate answers the question: "Can I release my code today?"
  • For pull requests (and short-lived branches), the quality gate answers the question: "Can I merge this pull request?"

By keeping an eye on the quality gate you can quickly judge the status of your code and decide on what to do next.


Was this page helpful?

© 2008-2025 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License