Will “Sonar Way” quality gate fail in case of the issues with the old code?

Hi, community!

I’m trying to dot the “I’s” and cross the “T’s” before introducing the changes on the company level.

Instead of the old quality gate focused on the old code, we have enabled SonarQube’s “Sonar Way” focused on the old code as a default gate (with the set of new conditions for failure). Also, in addition to the automated enforcement mechanism of these thresholds that are included in SonarQube, we’re going to block the deployments, so the question is:
“Will it be enough to meet all the requirements for the new code only, or issues with the old/overall code can also lead to a failure, and as a result, to PR/merge/release reject, and deployment blocking?”

SonarQube Developer EditionVersion 8.7 (build 41497)

Best,
Valeriia


Illustration of a situation in which the requirements for the New code are satisfied, while for the Old one is not.

Hi,

First, your version is past EOL. Before you roll this out to the team, you should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.7 → 8.9.3 → 9.1 (last step optional)

You may find the Upgrade Guide helpful.

Regarding your question, first I want to :clap: for putting a bow on this before you roll it out to the team. It will make adoption much smoother. :clap: also for going with a New Code Quality Gate. This will also help adoption and is the best way to go, long term.

I’m going to assume you actually meant “new code” here. :smiley:

If you’re using the built in Quality Gate, it will only be about new code. If you want to include some conditions on overall, you’ll need to add that in yourself.

 
HTH & sorry for the delay,
Ann

Hi @Valeriia_Iuzhakova,

In the screenshot you’ve configured the quality gate so that it checks the old code, not just the new code. This is why you’re getting a failure. The new code is fine, but you’re still having issues in the legacy code base.

I second Ann’s recommendation - enable the quality gate only for new code to improve code quality from here on, and treat the cleanup of the legacy code as a separate project.