Scanner command used when applicable: SonarSource/sonarqube-scan-action on Github
Languages of the repository: Swift
Private repo
Error observed (wrap logs/code around with triple quotes ``` for proper formatting): “Number of lines exceeded”, even though when checking in the organization settings we’re under the maximum limit. I got the following `analysis_id`: `ce5a652c-0e15-47df-b400-9d9b00b55541`.
Steps to reproduce: Try to run an analysis on main branch and get the exceeded number error.
Potential workaround: I do not get the error when trying to perform an analysis on non-main branches, when doing PRs.
More details:
This is the error I get on the project on SonarQube Cloud interface:
Noticeably, the analyses I’m running on branches other than the main one do not fail (see the icon on the left of the rows): Imgur: The magic of the Internet (using Imgur since I’m running on the 3 media limit for new users).
The message you’re seeing in the UI shouldn’t be using present tense, but subjunctive.
You’re not over your line limit yet. Your CI successfully submitted an analysis report to SonarQube Cloud. That’s the ‘analysis successful’ message you’ll see if you look at your analysis logs. The message you got about the main branch analysis is telling you that if that particular analysis were processed, you would be over your license limit. So to keep from basically locking you out, the analysis report is discarded rather than being processed.
At a guess, something in the relevant project changed to
add libraries
add generated files
update configuration to analyze previously ignored files
so that suddenly analysis is finding a lot more lines than it should.
Unfortunately there aren’t a lot of 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.
An update on this. I’ve checked the number of lines of code on my project after raising the limit, and realized it was quite high. Looking into the details, I had over 100k lines of XML (for an iOS project).
It turns out that it was the test coverage report file that was generated in XML that was being analyzed and thus responsible for triggering the limit issue (generating this XML was a recent addition).
I’ve excluded the coverage report in the sonar.exclusions property and now found back the number of lines I used to have.