Setting a Baseline for Code Quality


I’m working on a longstanding project and our team would like to focus on tracking and achieving quality goals for new developments. I’ve read about the Water Leak concept in SonarQube, the idea of setting a baseline, and it’s exactly what we need in our case.

Our goal is to establish the current code as our baseline and concentrate on meeting quality metrics for new code. However, I haven’t been able to figure out how to implement this in the Community Edition of SonarQube.

I’d like to know if this is an exclusive feature of the paid versions, or if there’s a way to achieve this with the Community Edition. If it is a feature of SonarQube, could you please guide me on how to use it?

Thank you in advance for your assistance.

Hi @Rodrigo_Gonzalez ,

Welcome to the Sonar Community!

We’ve evolved our methodology over the last few years and now recommend a (similar) practice called “Clean as You Code”. While the commercial versions of SonarQube offer a lot of great tools to help teams and organizations adopt this practice, you can definitely do this with SonarQube Community Edition. If you are using an older version of SonarQube, you should definitely upgrade to the latest release or LTS.

I recommend you start by reviewing our documentation on this topic, but if you have any specific questions, please feel free to post here and myself or one of my colleague will help further.



1 Like

Hi Brian,

Thank you for your prompt response and for welcoming me to the SonarSource Community. Your recommendation of “Clean as You Code” is certainly an interesting concept and something we’ll seriously consider for the future. However, I would like to delve a bit deeper into our current situation.

We are currently using the latest LTS version of SonarQube Community Edition. We understand the importance of keeping all code clean, even the older one, but in our case, we don’t want our development team to focus on older code. It can be quite demoralizing as this code was written by a different team and, honestly, our efforts would be better directed towards developing new features and fixing current issues.

Because of this, in our situation, it’s quite appealing to set a baseline and start tracking only the new stuff. The main challenge we find is that SonarQube’s overview shows the status of the whole project, not just the new code. While we understand that this is a useful feature, we would like to have the option to focus solely on new developments.

With that said, my question is, is there any way to set this baseline and monitor only the new code in the Community Edition of SonarQube? If it’s possible, could you provide some guidance on how to implement this? Additionally, I would like to know if the paid editions of SonarQube have any specific feature that allows this kind of focus on new code. If so, could you elaborate a little more on it?

In advance, I appreciate your help and your time.


Hi @Rodrigo_Gonzalez ,

When you say “the overview” do you mean an individual Project’s dashboard or the home page that lists all of the Projects?

In the case of an individual Project’s home page you will begin to see New Code metrics show up by default after the second analysis.

In the case of the Project list page, you can change the filter at the top of the list to the “New Code” perspective:

Hope that helps,


1 Like

Thank you very much, Brian, for your guidance. It does help, but it’s not exactly what I’m seeking. I’m interested in using SonarQube exclusively for the code added from this point forward.

I’m considering marking all current issues as “Resolved (Won’t Fix)” in the database until such time we choose to reuse this code. I’m not sure if there’s a more efficient way to go about this. Your advice would be greatly appreciated.

Hi @Rodrigo_Gonzalez,

If you want to go through the trouble to do that, there is a bulk edit feature from the in-app Issue browser that may be helpful. If you want to make blanket edits, I recommend you use the Web API for this purpose as direct edits to the database may have unintended consequences and are not supported. Check out the ‘api/issues’ in the in-app documentation.


1 Like

Thank you very much, Brian. Your advice has been very useful.