New LOC Strategy on Sonarqube

What is the new LOC strategy in Sonarqube? For example, when we make a change to legacy code, is it perceived as completely new code or are only the changed lines taken into account?
In addition, we want to analyze the developments made since January 1, 2024.
When we examine from this link : [Defining new code] , we see that only a certain threshold number of days can be included in the analysis from the day we want to analyze.
What we want to do is to include only the new codes written since January 1, 2024 in the analysis. Is this possible?

Hi @Gizem,

For managing Lines of Code (LoC) in SonarQube, you can refer to the documentation [SonarQube Lines of Code].

Regarding your New Code strategy, there are several ways to define “since 01/01/2024” using SonarQube’s New Code parameter:

  1. Create a Reference Branch: Create a branch containing the last code of 2023 and configure new code detection based on this reference branch.
  2. Use Previous Version: Identify the last 2023 analysis in SonarQube as a version and configure new code detection based on this version.
  3. Use Web API: Define the new code from a specific analysis (the last analysis of 2023) using the web API.

You can find more details on defining new code in the SonarQube documentation hereÂą.

I hope this helps! If you have any more questions or need further assistance, feel free to ask. :blush:

1 Like

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