New Code Quality Gate Conditions Missings

Why can’t we select the quality gates created in the overall code for the new code?

Hey there.

What version of SonarQube are you using? Can you share a screenshot demonstrating what you’re talking about?

Hi Colin,

We are using the SonarQube version you see below.

In addition, we can see conditions such as unit test duration, unit test success or unit test errors for the overall code. However, many of the conditions set for the overall code do not apply to the new code. For this reason, we are experiencing the problem of not being able to create most of the quality gates for the new code.
Could you please explain this situation?


Hey there.

First things first, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

9.4 → 9.9.3 → 10.3 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Finally – several metrics don’t apply to New Code. For example, all the Unit Test metrics you’ve mentioned. SonarQube simply doesn’t calculate test metrics on new code, since there’s no way (for most languages) to tie source code to specific test code.

If you have any Unit Test measures you want to include in your Quality Gate, you should do so on the overall code. At the same time, most build pipelines will fail if any unit tests fail… so they might not be necessary.