Report on Lines of Code

We are adding new projects to our existing SonarCloud account, and I hit

Your analysis has failed: your number of lines exceeds your organization plan

Is there a report or analysis as to how the lines of code are being used, so I can make a pricing decision as to which projects we want to add?

-Ted.

Hi Ted,

Welcome to the community!

Unfortunately, there’s no pre-rolled report for this. You’re going to have to find it (painfully) manually. What you’ll need to do is find the largest branch of each project and sum those LOC counts.

 
HTH,
Ann

Thank you for your reply, Ann.

The only LOC count I’ve been able to find is on on the Duplications panel of the Pull Request Summary.

For the PR in this screen shot, would 482 LOC have been charged against our monthly limit?

-Ted.

Hi Ted,

As I said, painfully manual.

For each branch and PR:

 
HTH,
Ann

Thank you, Ann, that’s helpful.

Do we have to analyze the main branch in order to see the total lines of code. Right now, I’m only seeing the New Lines.

We’ve been using SonarCloud with one repository for some time, and we’re in the process of adding four more (of various sizes). When I got to the second new project, we hit our current LOC limit, and I’m just trying to get an idea of how much of an increase we are going to need (250, 500, 1m?).

We’re using Git and so the branches are going to be roughly the same size as the default branch. If I know the default branch size, and I know how many PRs we create in a month, is it just:

(Default Branch LOC) * (PRs per Month) = Monthly LOC estimate.

I’m surprised that the billing function doesn’t indicate the total for our account someplace. Since SonarCloud knows we are exceeding the limit, you’d think we’d be able to view the current total for the month.

Hi,

Nope. Nope, nope, nope.

It’s

(P1 LOC) + (P2 LOC) + (P3 LOC) + (P4 LOC) = Total license LoC

We’re never going to do anything to incent you to analyze less frequently. We want you to get the benefit of analyzing every commit & PR, so you can’t “use up” your license by analyzing the same code base over and over.

Really, all you need to do is find the largest branch/PR for each project and sum those numbers.

Fair enough. I’ll ping the Product Manager on that.

 
Ann

1 Like

Thanks for calling this out; we now have a ticket to clarify LOC in the Documentation.

1 Like

I appreciate everyone’s help, and I’m busily onboarding our other projects now.

-Ted.

Hello @Ted_Husted ,

You can also find a distribution of private lines of code per project on your organization’s Administration → Billing page.

image

Thank you, Martin, that’s perfect!

-Ted.