SonarSource License: Excluding branches should clear available nloc, right?

Shouldn’t the license LOC be immediatelly updated upon branch exclusion?

  • Enterprise Edition
  • Version 9.9.1 (build 69595)

My company has a license that enables us to use X million lines of code (LOC).

Regarding lines of code:

Lines of code are calculated by summing the LOC of each project analyzed. 
The LOCs that are counted are those found on the largest branch of the project.

I’ve tested a scenario where one of our company’s projects had a considerably large amount of lines (+70K) in its only branch, and 0 lines in it’s master branch. However, after the deletion of that branch, no changes were shown in the license number at the administrative page.

Question 1: Must I analyse that project in order to its current LOC count be actually loaded?

Question 2: If I use the sonar-tools toolkit (as said here) to solve this inactive branch housekeeping, will my licensed LOC be properly fixed?

Thanks in advance!

Hey there.

Yes, in my testing, deleting the branch should immediately change what you see in the License Manager.

There was a little lag though (even just on my test instance with 1 project), so can you go back and check to see if the numbers moved?

You’ll have to ask it’s maintainer! But it looks like it deletes projects/branches that haven’t been analyzed for a long time, which is good license stewardship. (ping @OlivierK! :D)

1 Like

Hi @balbi_andre,

The sonar-tools toolkit helps in removing stale branches in an automated fashion across a potentially large number of projects, which would be tedious to do manually like you did on 1 project. It only automates what would take time to do manually. But its outcome is the same as if you delete manually.
So I believe that in your case, if you did not immediately saw the LoC count drop by about 70K after you deleted your branch, it’s:

  • Either because you did not wait long enough for the background process that re-evaluate LoC to finish. Like @Colin mentioned, there is a small lag.
  • Or there is another branch in your project that has more or less the same number of LoC as the branch you deleted and you missed it. As a consequence, the updated LoC count remained more or less the same.
2 Likes

Thanks for the response @OlivierKo and @Colin!

I’ll do a routine branch deletion in multiple projects and bring in the feedback!

@OlivierKo, how long does it take for this LoC background process to finish?

Second scenario: I’ve deleted a considerable amount of branches last friday (26/04), from lots of different projects (we have a big instance) and no changes were seen in the license manager.

Context: We’d made a previous analysis to check the difference between every project master branch and biggest branch, the first scenario, mentioned in the post (quote below), made me uneasy

I’ve tested a scenario where one of our company’s projects had a considerably large amount of lines (+70K) in its only branch, and 0 lines in it’s master branch

Is there any way that I can force this LoC background process to recheck?

Hey @balbi_andre

Sorry for the late response on this. Are you still facing the issue?

We have no known issues about calculating LoC in SonarQube v9.9 LTS, nor can we reproduce the issue ourselves. I’m wondering if it cleared up on its own since April, or if you have other news to report.