What is a Quality Gate in SonarQube?
March 2, 2025
SonarQube is a key tool for analyzing code. It consists of a series of mechanisms that help developers to ensure the quality and security of code. One of them, are the Quality Gates and in this article we will explain what they are and how you can configure them on an instance of SonarQube Server.
What is a Quality Gate?
A Quality Gate is a mechanism that measure whether a project meets certain quality standards. The user defines a set of conditions to be able to measure projects and answer the following question: Is my project ready for launch?. Examples of these conditions are: no issues and code coverage cannot exceed 40%.
¡Atention! Not all projects use the same Quality Gates. Why? It is not practical for all projects. For example, a web project does not need the same code coverage as a Java project.
For this, the user can define several Quality Gates. Below we show you how to create one.
How to define a Quality Gate in SonarQube?
To set up a Quality Gate on SonarQube Server you must follow these steps:
1 - Access your SonarQube instance .
2 - In the top menu access Quality Gates.
3 - Press the Create button and a screen will pop up for you to add a name to the Quality Gate.
4 - By default, in the Conditions section there is already a listing for you to edit values (issues, security hotspots reviewed, coverage, % duplicate lines)
5 - If you want to add more conditions, you have to press the button Unlock and then the one of Add conditions.
Once you have your Quality Gate created you can set it as default.
Benefits of using a Quality Gate
Here are some of the benefits of using Quality Gates to correct your projects:
-
Ensures the quality of code
-
Gives visibility to the quality process
-
Keeps the code safe
-
Encourages the use of good practice
-
Increases confidence on code development
SonarQube has specific information on the Quality Gates in its documentation
Use the Quality Gates Board for SonarQube
At bitegarden we have developed a plugin so that you can validate your code against more than one quality threshold. We are talking about Quality Gates Board for SonarQube, which adds a page within the project so you can validate if your code meets more than one quality threshold.
On this new page you will be able to customize the title of the quality thresholds so that it is easier to read the analysis of the information. Below, we leave you an example of this page within a SonarQube Server project:
If you want to test this plugin on your instance, you can download it via this link.
bitegarden team
Helping companies to develop better software