SonarCloud Reports Reached Maximum Allowed Lines of Code Limit

Hello Community!

We recently encountered an issue in our SonarCloud instance that is quite confusing to determine how to best resolve.

We have our main branch called DEV which Sonar continuously analyses for any merge requests.

While I can see in our Gitlab logs that Sonar did performed the analysis on a scheduled run for this branch, it had an issue:

Error during SonarScanner execution
CE Task finished abnormally with status: FAILED, you can check details here: https://sonarcloud.io/api/ce/task?id=*********************

Details of the issue (from the link) is below:

errorMessage":"This analysis will make your organization \u0027*********\u0027 to reach the maximum allowed lines limit (having 111540 lines). \nPlease contact the administrator of the organization to resolve this issue."

We also have another branch (let us call it QA) where Sonar analysis is also performed when the changes made to the main branch is being pushed to that branch.

On the QA branch though, SonarCloud did run and was able to report on the issues that the analysis found.

In this regard, we wanted to know why our main branch will report the maximum number of lines were reached, when our QA branch which would technically have approximately the same number of lines was able to get the SonarCloud analysis and reports run successfully.

Looking for some insights to get this resolved.

Thank you.

Hi,

So it sounds like you have this(…?)

  • DEV - new commits here
  • main - commits added here after they’re okay in DEV?
  • QA - same as main(?)

Which would indicate that DEV is at least a few commits ahead of the branches that are still analyzing okay? So it sounds like new Lines of Code got added to DEV, but they haven’t made it into the other branches yet, which is why those branches can still successfully analyze.

Does that sound right?

 
Ann

This is what we have:

  • dev
  • qa
  • master

We usually branch out of dev for any features / fixes that we work on and merge it back to dev. Once everything is tested and verified in our dev environment, we push those changes into the qa branch.

We have daily scanning schedules performed on both dev and qa branches, and a snapshot of these branches LOCs shows the following:

A scan for both branch happened today and we encountered the issue on the scan on DEV branch but not on QA.

Note that I have highlighted JSON as that’s supposed to be not scanned by Sonar.

So, just a little stumped that QA will have the scan run and get reported in SonarCloud but not our DEV branch.

Hi,

So it sounds like it’s within your normal workflow for DEV to have more LOC than QA since new code is added to DEV first, right?

 
Ann

Typically yes. Unless we perform merge requests focusing on removing unused features/codes or have done refactoring that reduces the lines of code in different files.

Hi,

So then this is perfectly normal. Your DEV branch analysis is failing because more LoC were added to it, pushing your project/organization over your license limit. The other branches can still be analyzed because those code additions haven’t made it that far yet.

 
HTH,
Ann

I will try and see if I reduce the LoC (either by deleting unused codes or exclusion of specific folders) will make a difference.

I’ll perform an attempt to make the LoCs for the dev branch much less that the LoCs for the qa branch and we can see whether the scanning will push through.

Hi,

Another option would be to increase your license.

 
:smiley:
Ann

Of course that option is one of the choices we have on the table.

I just wanted to technically know why the scan summary reporting happens on the QA and not for DEV.

1 Like