How to set quality gate to show critical issues on new code only (over Leak period)?

q_gate
sonarqube

(Naveen Arora) #1

How to setup a quality gate that shows the below conditions on new code only -

  1. New Critical Issues
  2. New Blocker Issues

Currently, my quality gate is fetching results for the entire source code and not on the set Leak Period, can you help me reason out ?


(Nicolas Bontoux) #2

Hi,

The Quality Gate (QG) documentation is a good starting point: https://docs.sonarqube.org/display/SONAR/Quality+Gates

And if you really need a more custom QG then you should be able to simply create a new QG, and set conditions as you wish (e.g. New Critical Issues, New Blocker Issues). If you don’t manage to do so, then do share details of what’s not working (and versions you’re using).


(Emre Dundar) #3

Hi Naveen,

You can create a new custom Quality Gate like this:

And you need to set it as default Quality Gate or manually for your projects.


(Naveen Arora) #4

Okay, thanks Emre and Nicolas. My question was more from the quality code of a New Code vs Entire repo -
Picture this - I setup the quality gate, setup the leak period and scan the code. Now, I see the whole set of critical issues from the entire repo even if that part of the code is not being touched upon since a year.

Does Quality Gate shows the critical issues from the leak period (comprising of the changed or new code) or from the entire repository?


(Naveen Arora) #5

The issue is resolved, I basically ran consecutive scans and based on the leak period, critical issues were shown on new code only.

Thank you Emre and Nicolas for your advice !


(vicky) #6

Hi,
@Naveen_Arora Just one extra information i would like to add is that Quality gate is a global entity for whole project, you can’t set up any specific quality gate for certain modules or code of the same project as for entire project it will be same. Also new issues you can get through leak period but that doesn’t mean your previous code is not being analyzed but it means that your this analysis has detected this much issues which was not in previous analysis.
Hope this will help!:grinning:


(Naveen Arora) #7

Sure, thanks Vicky for the added information, appreciate your advice !