I’m getting the “##[error][SQ] Task failed with status FAILED, Error message: The last analysis failed because it would have caused your server-wide lines of code total to exceed your 1000000 limit.” error during the Publish Quality Gate Result on a build.
I have a license for 1 million LOC, currently ar 700k, the new project is 200 loc, what’s up with that?
Details below, thank you in advance for any advice.
SonarQube ID information
Server ID: 29DC1D7A-AWxDcOGx9rt_ZDjBrJjn
Version: 8.4.1.35646
Date: 2020-11-27
I had exactly the same problem a couple of weeks ago, and it turned out to be the 4.17 of the Azure DevOps SonarQube Scanner Task (which had automatically been updated) was managing to analyse .NET Core projects that had in the past been skipped as they had no ProjectID.
When running the scanner, it finds 10 C# files (which I guess what is counted by the “Code Metrics” tool screenshot with 1167 LoC.
But the scanner also finds 6 CSS files and 147 JavaScript files.
If those files are intended to be scanned, then definitely your LoCs in that project is much more than 1167. 6+147=153 files seems a bit too little to produce 300K LoCs but it remains realistic if those files are relatively big.
If those files should not be scanned, then you must exclude them explicitly. Pass /d:sonar.exclusions=**/*.js,**/*.css to your scanner begin step for that.
Excluding the files worked like a charm, it was some huge MS js files that were the culprit. I’ve added in the necessary exclusion entries to the project.