Analysis will make org to reach the maximum allowed lines limit (having 1047834 lines)

Template for a good new topic, formatted with Markdown:

  • ALM used (Azure DevOps)
  • CI system used (Azure DevOps)
  • Scanner command used when applicable (private details masked)
  • Languages of the repository C#
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
    ##[error][SQ] Task failed with status FAILED, Error message: This analysis will make your organization to reach the maximum allowed lines limit (having 1047834 lines).
    This is only happening with the main branch of the project. The develop branch run with no issues.
  • Steps to reproduce
    CI Build triggered after pull request
  • Potential workaround


Welcome to the community!

Can you double check the main branch configurations versus the develop branch configuration? I suspect the main branch analysis isn’t excluding some libraries or generated code that the develop branch is configured to omit.


Hi Ann,

I could not found nothing different in terms of configuration on Git, on the CI Pipeline or on SonarCloud
Should I delete the project on SonarCloud and import it again?


Hi Ruben,

Before you do that, let’s get some more expert eyes on this.


Sure Ann. Let me know if you need more info form my side.

1 Like

Hi @rvilhena10 , could you please let me know if you still have the same behavior as reported previously:

This is only happening with the main branch of the project. The develop branch run with no issues.

Hi, I can confirm this is still happening. The CI build for the main branch keeps failing with that error message.
I have looked and the CI Build configuration, and the GIT Repos and I can’t find any difference that would justify the difference.

Is there anyone that can help or provide a suggestion? Currently have a CI build failing due to this.

I am not having any answers for the last days. Shall I start thinking about delete the project on SonarCloud and re-add it? Will that help?

Solution LOC
I have attached a breakdown of the lines of code for the solution.
I have also deleted the project from SonarCloud, added it again, tried to scan and got the same error.

2022-10-12T09:27:45.2014322Z ##[section]Starting: Publish Quality Gate Result
2022-10-12T09:27:45.2196914Z ==============================================================================
2022-10-12T09:27:45.2197215Z Task : Publish Quality Gate Result
2022-10-12T09:27:45.2197561Z Description : Publish SonarCloud’s Quality Gate result on the Azure Pipelines build result. To be used after the actual analysis.
2022-10-12T09:27:45.2201755Z Version : 1.11.2
2022-10-12T09:27:45.2201966Z Author : sonarsource
2022-10-12T09:27:45.2205302Z Help : Version: 1.11.2. More Information
2022-10-12T09:27:45.2205732Z ==============================================================================
2022-10-12T09:28:03.3285376Z ##[error][SQ] Task failed with status FAILED, Error message: This analysis will make your organization to reach the maximum allowed lines limit (having 1047834 lines).
Please contact the administrator of the organization to resolve this issue.
2022-10-12T09:28:03.3374114Z ##[section]Finishing: Publish Quality Gate Result

This message means that the analysis you are trying to execute has more LOC than the paid plan your organization is subscribed. This could mean the configuration for this analysis have some issue, like bad ignore expression for tests or other kind of files. But you mentioned that there is no difference between branches configuration so i will take a look into your organization this afternoon to check if there is something else.

1 Like

Hi @rvilhena10 , i looked at the logs you provided (thanks) and also some logs we have internally. Unfortunately, they don’t tell me the amount of LOC that is being analysed.

I looked for a similar issue and found this topic: Developer Edition: Failed analysis due to lines of code limit - #8 by ealdana0. Could you please take a look and check if the exclusions configuration fix your problem?

Hi Alexander,

I had a look at that post but I am a bit lost here.

I don’t have any exclusions configured. And I am not sure what exclusions to configure?

This is a not very big .Net project so not really sure what I can/should exclude! Any suggestions?


We need to know first which files are causing the limit to be reached. Could you please use the tool CLOC on your project, using the same commit hash that failed the analysis? It will produce a nice output like this:

$ cloc 1f73c495392b12d4876d583c7ae3015ad9afaa53
    4827 text files.
    4645 unique files.
     183 files ignored. v 1.94  T=8.35 s (556.1 files/s, 87952.3 lines/s)
Language                      files          blank        comment           code
PHP                            4143          48878          82817         531291
XML                             167             25              2          33656
Markdown                        132           2067              0          11836
Twig                             61           1112            138           9403
XSD                              12            332             52           4800
JSON                             64              0              0           3171
CSS                               6            259             10           1931
YAML                             10            119             22            705
JavaScript                        3            149             37            578
diff                              1             36            571            514
Bourne Again Shell                2             12             14             68
SVG                              40              0              0             45
Fish Shell                        1              7              6             16
Text                              3              2              0             11
SUM:                           4645          52998          83669         598025

You can send me the output in the private message if you want.

Hi Alexander,

See below results from CLOC:


Thanks a lot! assuming this is the LOCs for the failing main branch commit, could you please to the same for the commit on the main branch that worked before (i saw that your main branch has one successful analysis at SonarCloud)? Additionally, could you also use CLOC with develop branch, using a commit that was successful, please? We should have such LOCs in our logs in the future, but now i can only rely on your output, sorry for that.

After you provide these LOCs, i will check the differences and also evaluate exclusions. For a .NET project, i see that you have a lot of CSS and JS LOC (only these two languages go over your LOC limit, or CSS + C# for instance). The exclusions “exclude” files from the analysis, you can read more here and in the topic i shared before (you have multiple places to setup exclusions as explained there). Your logs tell me there are any exclusions at the failing main branch analysis:

2022-10-12T09:25:14.3514997Z INFO: 0 files ignored because of inclusion/exclusion patterns

So, my conclusion is that these CSS and JS files are analysed, causing the limit issue. Let’s see the output you will provide about the other commits (main with success, develop with success) to have a better understanding.

This is LOCs for the successful Dev Branch.

Just to confirm you are suggesting for me to exclude the CSS and Javascript files/folders, right?

Yes. If you want these type of files to be analysed, you need to upgrade your plan to a bigger amount of LOC. Otherwise, you need to exclude them from the analysis, because our analysers will process all incoming files.

There is a huge difference for the JS files. The successful Dev branch has 17663 LOC and the master failing has 520773. I am not sure about your project structure, but would guess NodeJS dependencies (node_modules folder) being pushed into your repository.

Yes, I noticed that too. Will need to confirm with the developers the reason for it. For now I am ok to exclude those files. I have read the documentation but not sure if I need to exclude the file type or folder type.
Adding this made no difference:

The documentation does not provide examples.

1 Like