We want to get LOC of a specific branch. Is that possible vs getting the project LOC?
Yes this is possible, you should select the branch you want to see in the branch menu at the top of your screen and then go in the Measures page and then in the Size section.
Thanks but I found this API https://sonarcloud.io/api/measures/search_history
I’m a little confused. how does the ncloc used in this manner? Only calculated the differences between x branch to the main branch?
Also, im talking about total line of code and not new lines of code.
This api is not available for pull request, we don’t keep history of pull requests. This only works for long living branches.
Also the “ncloc” metric doesn’t exist for pull requests, we only compute the difference with the target branch, so only “new_lines” exists for PR.
What are you trying to achieve by getting those numbers ?
We want to track the number of line of code (+/-) and total line of code being pushed to certain branch e.g. master or production/release branch.
anyhow. I’ve tested it and it works for long living branch. thanks!
for the record, could you post small snippet on how do you call the API to get, for a project, nloc per branches?