# Quality gates

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](/sonarqube-cloud/standards/managing-quality-gates/introduction-to-quality-gates.md).

## Quality gates appear with analysis results <a href="#quality-gates-appear-with-analysis-results" id="quality-gates-appear-with-analysis-results"></a>

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)

To see the quality gate for your project's branch or pull request:

1. Go to *Your project* > **Summary** page.
2. Select a branch or pull request.
3. View the quality gate status for the selected branch or pull request.

<div align="left"><figure><img src="/files/hRyK6ZzHvQAxnVp3TQSc" alt="Checking the status of the quality gate for a branch or pull request"><figcaption></figcaption></figure></div>

If you are using the [SonarQube for IDE](/sonarqube-cloud/analyzing-source-code/connected-mode.md), 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? <a href="#when-is-a-quality-gate-not-computed" id="when-is-a-quality-gate-not-computed"></a>

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 recent versions 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.

<div align="left"><figure><img src="/files/xf9mxIp5zQwlLKBhxhJf" alt="You will see this banner when the SonarQube Cloud quality gate has not been computed." width="563"><figcaption></figcaption></figure></div>

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 [Quality standards and new code](/sonarqube-cloud/standards/about-new-code.md) page.

## How quality gates are used <a href="#how-quality-gates-are-used" id="how-quality-gates-are-used"></a>

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.

## Related pages <a href="#related-pages" id="related-pages"></a>

* [Understanding quality gates](/sonarqube-cloud/standards/managing-quality-gates/introduction-to-quality-gates.md)
* [Subscribing to email notifications](/sonarqube-cloud/managing-your-account/notifications.md)
* [Viewing a quality gate](/sonarqube-cloud/standards/managing-quality-gates/viewing-quality-gate.md)
* [Managing custom quality gates](/sonarqube-cloud/standards/managing-quality-gates/managing-custom-quality-gates.md)
* [Changing default quality gate](/sonarqube-cloud/standards/managing-quality-gates/changing-default-quality-gate.md)
* [Associating a quality gate with projects](/sonarqube-cloud/standards/managing-quality-gates/associating-projects-with-quality-gate.md)
* [Quality gate](/sonarqube-cloud/managing-your-projects/project-analysis/changing-quality-gate.md)

## Related online learning

* <i class="fa-video">:video:</i> [Administering quality gates in SonarQube](https://www.sonarsource.com/learn/course/core-concepts/a0f784bb-0722-4c97-ac5f-9e250686014b/administering-quality-gates-in-sonarqube)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-cloud/standards/quality-gates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
