Status Passed/Failed considers only New Code

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 8.4.2
  • what are you trying to achieve
    Status Passed/Failed (green/red) of any project considers only New Code. I would like SonarQube to consider Overall Code instead of only New Code when deciding if a project should have status Sucess or Failed.
  • what have you tried so far to achieve this
    I tried to increase period of New Code to 30000000 days but it didn’t helped.

Hi @milantomic

The way to proceed is to change the Quality Gate criteria that you have set up.
Just go to the Quality Gate tab on top of your SQ page. In case you are using the Sonar Way (Quality Gate Built-In), you’ll have only conditions on New Code here:

To change this, you have to copy the QG (on top right) and create your own:

Then, you see that you can change the conditions/criteria. So you can add conditions on the Overall Code to make your QG fail in case the conditions are not met, by clicking on Add Condition button:

In the same time, while it’s good to have conditions on the Overall Code to manage your technical debt, it’s even better to focus on the New Code because that means that the code you are currently writing is good, safe and clean.

Let me know if that helps,

1 Like

Thank you soooooo much :slight_smile:

1 Like