Sonar Line of Code Calculation is not as expected

Hi Team,

we understand from below page Sonar will calculate the LOC based on below logic.

How are Lines of Code (LOC) counted?

LOC are computed by summing up the LOC of each project analyzed. The LOC count for a project is the LOC count of the project’s largest branch

But still have confusion on the calculation of logic. We had migrated project from sonar 6.7.2 to sonar 9.1.0, we have projects with multiple branch below is the example with project,branch,loc we see the sonar treating each of these as a separate project and our calculation for license if going off as it has counted not just the largest but each of the branches separately.

trade.cash.frm,release-0.0.1,643
trade.cash.frm,release-10.0.1,700
trade.cash.frm,release-10.4.0,765
trade.cash.frm,release-10.5.0,765
trade.cash.frm,release-10.6.0,768
trade.cash.frm,release-11.0.1,889

Wanted to know why its behaving like this. Let me know if this question is not clear.

Thanks

Hello,

In old version of SonarQube, branches were handled as separated projects with a “branch” suffix somewhere to distinguish them. If you did nothing after the migration (purging old fake branch projects), then all analysis of your past branches are actually projects in SQ 9.1

To confirm that, do you see your branches (release-0.0.1, release-10.5.0, …) in the Projects page? Can you share a screenshot of the Projects page filtered on the name “trade.cash.frm”?

Thanks
Alex

Hey Alex

Please find the attached screenshot.

I got your point on old sonar version handling separated projects with a “branch” suffix. Can you please tell me the way we can purge all of the old branches and also explain how new project will look like under new SQ 9.1.

Thanks