SonarQube Developer edition 10.1
Scanner 4.8.0.2856, later on 5.0.1.3006
C++
Using build-wrapper to build, sonar-scanner.bat to analyze.
Hi,
I’m a SQ beginner, evaluating SQ for C++ projects in my company.
While attempting to analyze a few c++ vcxproj-s, I hit our max of 500K lines, and analysis failed of course.
Here’s some more information with questions that came along the way.
I built only 3 projects out of 50 with the buildwrapper command line:
build-wrapper-win-x86-64.exe –out-dir SonarQube “path-to-MSBuild.exe” /t:Rebuild path-to-solution.sln
This produced the two build-wrapper files, log and json. Then:
Scenario 1 (good):
I ran sonar-scanner.bat, passing it the explicit 3 folders of the project (using -D”sonar.sources=PRJ\proj1,PRJ\proj2,PRJ\proj3”), where PRJ is the top directory.
That produced a useful report, and the “line of code” reported was 9.3k.
Scenario 2 (bad):
As a test for preparing a bigger build, without running a new build, I ran the scanner command again, this time passing it the top project directory, i.e. -D”sonar.sources=PRJ”.
This time, in the command line output, the analysis was reported as successful (“ANALYSIS SUCCESSFUL, you can find the results at: …”), however the report webpage showed the error “Server-wide lines of code total to exceed your 500000 limit”.
Scenario 3 (bad):
I hid most of the projects in the PRJ folder, by moving them outside altogether. That left the 3 original projects and an additional 3 others.
Ran the previous bat command again, and still reached the 500K limit, although my counting of the lines revealed about 40K, counting the lines in all *.* files – i.e. even in non-source files.
I made sure the lines count wasn’t accumulating, by removing the extra 3 folders, leaving the original 3 – and this time the report was successful again, and the line count was 9.3k.
I ran the batch again using the -X switch to produce a detailed debug output, however there was no meaningful data revealing why the large line count.
There were suspicious lines in one of the previous command line output:
Sensor CSS Rules [JavaScript]
1 source file to be analyzed
1/1 source file has been analyzed
Hit the cache for 0 out of 0
Miss the cache for 0 out of 0
Sensor CSS Rules [JavaScript] (done) | time=40953ms
Now – we don’t use CSS in our projects and there isn’t such a file in the PRJ folder.
Questions:
- Why was the batch output reporting a successful analysis when actually it had failed?
- For scenario 2, why was the scanner counting and/or analyzing code that was not built (meaning, it was not appearing in the generated json dump)?
- For scenario 3, how did the scanner count over 500k lines where there are actually under 40k?
- What is the “ghost” CSS file that was allegedly analyzed, and how come it took ~41 seconds to analyze it?
The problems described are currently stopping me from further trying out the product.
I’d be happy to supply any missing info.
Thanks!