which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
====================================================================
=> Version: 8.9.1.44547
what are you trying to achieve
===============================================
How to calculate the total LOC ? (total projects: 70)
What can be reason of immediate increase in total LOC ?
How can we use Sonarqube web API to get LOC data of each project?
what have you tried so far to achieve this
================================================
=> Based on the Sonarqube documentation, For LOC of individual project , branch having largest LOC will be considered. And sum of all projects’ LOCs will be considered the total LOC.
=> Last week, we have tried noting down the LOC of each project and calculated the sum of all . My calculation summed up to 493 K, but the administration page has different total = 524K.
=> While we were thinking to monitor the change in number , In three days , the administration page shows total increased to 966K which means it’s about to reach our threshold of 1M.
I would be grateful for the response on this ticket/topic.
We have used sonarqube web-api to get “ncloc” Metric value for each of our projects.
We have 69 projects and each of them have unique project key.
Per project key , we fetched “ncloc” value.
We have considered all the projects that comes under “TRK” qualifiers.
sum of all 69 “ncloc” values is : 530586
The administration page shows total LOC : 966,651
The screeshot is attached.
Please help us find the reason of this different total. Are we looking at correct metric value (“ncloc”)?
What is the impact on my LOCs consumption vs my license?
The LOC of your largest branch are counted toward your license limit. All other branches are ignored.
If you want to manually compute the LOCs consumption you need to take into account the LOCs scanned on your Branches. For each projects, you need to loop on the Branches and get the LOCs. Then take the max of them for each project.
If you used the API api/measures/component or api/measures/component_tree, you need to provide the branch parameter. If you don’t, you will get only the LOCs on your Main Branch.