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

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 ?

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).

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.

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?

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 !

2 Likes

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:

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

Hi Naveen, How do you run the consecutive scan ?
I’m facing the same issue as it scan for entire code even if the change is done to yaml config