SonarCloud - billing, projects and other

As I am interested in the solution SonarCloud and I would like to know more about how the billing goes. I have only one Azure DevOps Project and many repositories inside. I am billed only once for this project (LOC) or for each repository (LOC) ?
Is my code stored on SonarCloud or just partitions of the code when change is done? Can I set retention policy for how much code stays over there?
Is community confident on sharing the code to the sonar as my enterprise is working with some sensitive code.
How to do the estimation of LOC that is closest possible to the loc that sonar will do?

Thank you in advance!

Hello @ahmed-babic,

Thanks for posting on the community and welcome to SonarCloud!

For questions related to billing, I invite you to check this page. Billing is per organization, covering all private projects within that organization.

Yes code, once analyzed, is stored on SonarCloud. There is no retention policy, however you are in control and are able to delete your project any time. You can find more details here about how SonarCloud handles security of your information.

In regards to LoC estimation, SonarCloud accounts for non-empty, non-comment lines of codes for the languages you analyze. You can influence this as well by choosing exclusion patterns, for instance, to analyze or not specific file extensions, directories, etc… More information about this here.

I hope this helps! Regards,

Hi @AlxO,

Thank you for a swift response. However I did not get an answer for the following:
e.g. I have one organization, 1 AzDO project, 5 repos. Am I billed for 5x LoC, or only for the biggest repository according to LoC?
Anyway that I can do by some free tool estimation of LoC that will give the same number as Sonar would so I know what would be the cost before I start?

Hi Ahmed,

You chose which repos to analyze in SonarCloud and are billed based on those. If you use branches, only the largest one is counted. We also don’t count comments and empty lines.

The tool to calculate LOCs reliably is going to be SonarCloud itself! :slight_smile: You can sign up for a free 2 week trial directly online and also take the ride to see how it works.

It should be fairly simple to start and if you need some guidance this will help:

Best regards,


Hi @LuisM, is this what I will be billed for? Example in the guide which I used to test out tool. So in the example provided by sonar-scanning-examples is 43 lines of code

Hi Ahmed,

The LOC count would be the sum of all the projects. If you only have this one, yes it is 43 LOCs and you only need a 100K LOC plan.

To be clear, you are never billed more than the plan that you chose. If you try to analyze more that the plan you are subscribed to, the analysis will fail and you can either: 1) upgrade to a higher plan or 2) remove some LOCs/projects to fit your subscription.

To manage the subscription, go to Administration >> Billing.

Hope this clarifies.

Hi @LuisM,

Thank you very much for helping out here. I really appreciate your support. I have another question regarding calculation of lines of code. Do you count JSON or SQL files when calculating cost for a project? Are these included in the LoC when Sonar is reviewing it? I know that for these you can’t do much regarding analysis but I would like to know are they included in the billing proces?
Thanks a lot!

Hi @ahmed-babic

Only recognized languages are counted.

If you want to exclude files from the analysis (and billing) this should help:

1 Like

2 posts were split to a new topic: Not able to make payment with visa card