I’m using SonarQube Cloud: Server version 8.0.0.86467 via Azure DevOps.
I’m getting the following error message: ##[error][ERROR] SonarQube Cloud: Error while executing task Publish: Task failed with status FAILED, Error message: This analysis will make your organization ‘’ to reach the maximum allowed lines limit (having 418244 lines).
This is straightforward, and we’ve had this happen before. Our account allows 300k lines and this analysis is finding 418,244 lines. Before we had this error, we had around 260k lines. The problem is that I don’t know where all the new lines came from. The build that ran where we started seeing this error did not add so many lines.
I’m looking at the project that first got the error and in the Measures/Size screen it says the project has over 12 million new lines, which is certainly not correct. If I break down and look at where those new lines are found, they are in folders that we’ve already excluded from analysis and have been excluded for months or years.
Where else can I look to find the roughly 60k lines that the account thinks we have added? I can’t rule out another folder that was meant to be excluded but I can’t find it. I’ve poured through the logs from the Azure pipeline and from the background processes in SonarQube but I found nothing that can help me track down this issue.
At a guess, something in the relevant project changed to
add libraries
add generated files
update configuration to analyze previously ignored files
Can you double-check that those exclusions are still in force? One way to do that is with the sonar.scanner.internal.dumpToFile=[path to file] parameter, which will let you see the flattened list of parameter values analysis is operating with.
Unfortunately there aren’t a lot of other tools to help you figure this out except to set sonar.verbose=true in your analysis parameters and check your analysis log for the files being indexed.
I am able to double-check those exclusions and they are in place. I also set sonar.verbose=true but did not see anything unusual about the files being indexed, though I admit it is a lot of log data to go through so I’m not sure if I missed something.
As an experiment, I updated my exclusions list to include a large block of code from my project, in the hopes that I exclude it and then I can see what is left but even with the new exclusions in place and the fact that it lists the new inclusion as in force, the number of lines in the analysis did not change at all and “new code” is still stuck at the unusual number it had before where it says we added 12 million lines (all in excluded folders).
What can I do? It’s almost like my analysis appears stuck and I can’t do anything to make it work again. Is there a way to clear out the project and re-analyze it? At this point we have had this problem almost a week and it’s affecting our ability to move forward in development.
Are you on SonarQube Cloud or SonarQube Server? And it sounds like the server (or cloud…) actually accepted and processed your 12M LOC analysis report? It shouldn’t have, for exactly this reason: once you’ve crossed the license threshold, the only way to un-stick analysis is to bump up your license.
I’m on SonarQube Cloud. If I delete the project and re-build it, will it put me back under the threshold? We solved a threshold limit in the past by deleting a couple of old projects no longer in development.
I’m not sure it accepted the 12M LOC analysis report correctly, because my account says I’m still at 259k lines and the error says I will end up with 418,244 lines if the analysis is accepted. I don’t know why the new code lines show 12M in new lines. I do not believe I’m going to get approval to increase our SonarQube account to 500k lines, but I’ll float it as a last resort if I can then move it back to 300k once this issue is taken care of.
I’ve been doing more testing of it while waiting for a response, and if it’s true that once the limit is reached I can’t exclude ourselves out if it than that’s consistent with what I’m seeing in the logs because it’s still indexing folders that I have added exclusions for.
Out of our 7 active Sonar projects only one of them has had PRs in the past week. Here are the exclusions for it, including a folder in our UX project called “Content” that has some 3rd-party components in it. This exclusion has been in place for years. I had a screenshot of it but I do not appear to be allowed to post with more that 3 screenshots so I removed it.
Here’s the “new lines” in the project from the last successful analysis:
Note that “content” folder should have been excluded and this used to work. I also have a couple other folders like this “obj” folder that is a mystery to me why it’s making it into the analysis as it doesn’t exist in my project, but any attempt to exclude it has been ignored. I also tried to exclude the entire “UX.Web” project from analysis to get rid of all of this but that is ignored as well.
If it helps, my latest analysis ID is AZ30cqyCzLBvC_oxHGYi.
With verbose=true, the resulting log is about 150,000 lines and it will take me some time to redact. Are there lines in particular that I can pull out of it that you’d like to see, like the lines where the files are indexed?
I really appreciate the help with this issue, I am completely stumped on how to resolve it.
Is this a multi-module project? Those logs are always long. I don’t need to see the sensors run. But I would like the top… let’s say 250 lines. That should give me your analysis system spec and show me what exclusions are being applied, as well as the SCM pre-check.
From what I can tell, your exclusions are being applied.
I’m seeing a lot of PDFs and gifs in the list of indexed files. You may want to add them to your exclusions (although since they’re indexed with “language ‘null’” I’m not sure it will help.)
I can see this is a C# analysis. And the SonarScanner for .NET has sonar.scanner.scanAllon by default. Can you try a run with sonar.scanner.scanAll=false in your configs?
I ran with sonar.scanner.scanAll = false and that took care of the maximum limit error. The “new lines” report still lists 6 million new lines but there is no error and the project has changed from 160k lines to 130k lines.
I’m still having problems with exclusions- now some folders that I have exclusions for are showing up in the analysis and folders that I excluded for testing but removed the exclusions are still excluded. But the analysis runs and I think I have what I need to keep my development project moving.
I appreciate the help on this problem, it’s good to have the analysis working again. I think I still have a few days of work ahead of me to fix the exclusions and to make sure having scanAll=false does not ignore files we are expecting to be scanned but at the moment I’m in much better shape than a few days ago. Thanks again for your help.
They’re showing up in the analysis logs, or they’re showing up in the analyzed code on SonarQube Cloud? Unfortunately, for the SonarScanner for .NET exclusions are applied server-side. Everything is analyzed in the CI and then excluded files are removed from the analysis later. That’s the only scanner flavor that acts that way. (Yes, we know it’s an issue.) The other scanners filter out excluded files on the front end and don’t analyze them.
They were showing up on the analyzed code in SonarQube Cloud, especially as new lines.
I did some work and I’ve fixed the exclusions to include some stuff that I do not want analyzed and everything is more or less back to where it was before the problems started. Thanks again for your help, I appreciate the time you took to help me out here.