New Code vs Overall Code for Quality Gate Conditions created using SonarCloud Web API

Hi All,

I am working on a Terraform Provider for SonarCloud which can be found here:

Specifically I am working on implementing Quality Gates as specified in this issue:

One issue that I came across when implementing quality gates is that all the quality gate conditions that I create using the web_api only apply to overall code, and there isn’t any mechanism that I can find for these conditions to affect new code. I was wondering if there was another api that was already present that I could use for this purpose, or if anyone could implement another field in the web api to expose such an option. Looking forward to the response, I’m excited to see if I can get this terraform resource working :smiley:!

Thank you,
Arnav

Hey there.

Take a look at this guide here:

1 Like

@ArnavB I’ve looked at the calls as @Colin suggested, and the different is that for only on new code, the metric name gets prefixed with new. For example, metric: "branch_coverage" becomes metric: "new_branch_coverage".

1 Like

Oh, thank you for looking that up. I’ll add those metrics to the lits/testing.

Thanks everyone for the help! :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.