-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analysing the project takes extremely long time #2267
Comments
Hi @Artalus, thanks for your feedback.
Like to start with the last point first because that would be clearly a bug in our plugin. Maybe you can turn debug info on and verify it: https://github.com/SonarOpenCommunity/sonar-cxx/wiki/Get-Debug-Information. I understood you are using: https://github.com/SonarOpenCommunity/sonar-cxx/wiki/sonar.cxx.jsonCompilationDatabase? That would mean all .CPP files listed there under "file" are handled. In case include files of .CPP files can be found (include path provided) it's also handling these files.
Ignoring third-party headers would result in syntax errors:
Last hint I like to give is #2131 that could also be a root cause for being slow. Regards, |
...and another comment https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/ is only about filtering source code files and has nothing to do with including/excluding include files. |
From my understanding, yes - it seemed to me that the plugin ultimately collected everything that matched for C++ file extensions, and tried to parse even files not mentioned in compilation database. I cannot test this behavior right now - but I will try to provide additional info later.
Is it not possible to provide source code "as is", without parsing each and every function and identifier in every header? While it is definitely a nice feature needed to navigate the source tree, it seems to me that the plugin tries to bite more than it can chew. At least for our needs, the very basic syntax highlight like "this is keyword, this is operator and this is string literal" would surely work. If this is needed in any case because of some SonarQube quirks, can this parsing be done concurrently, at least with different files being parsed in parallel? Right now it seems that the plugin processes files one by one, which is extremely slow in large codebase. |
Hi @Artalus,
Easy to verify: Which files do you see in the UI? SonarQube (SQ) works like this:
Thinking about this the problems seems to be that the sonar.cxx.excludeIncludeDirectories=...
That's also something we discussed with SonarSource. A possible solution could look like this:
Our solution is on top of https://github.com/SonarSource/sslr, we are not sure if the library is multithreading safe? This is for sure a bigger effort. There are still some other possibilities to speed up the preprocessor:
At the end it's always about the effort we are able to spend. Interestingly, I don't think the commercial C++ plugin based on the clang parser is really faster either :-). A solution with manageable effort seems to be: Regards, |
Both related and unrelated ones. F.x. we have a subfolder that is not mentioned in cmake and not used by it at all - yet in SQ UI I still see sources and headers from it, since I forgot to add it to
Given that unrelated headers are mostly grouped under some common directories, like
This IMO does not mean that "plugin's parser is on par with clang-based one", but rather "both are slow and single-threaded" 😞
My current task is basically "provide means to view PVS-Studio reports conveniently". Currently I decided that at this point, this would be easier done in CI via Jenkins and its "warnings" plugin, rather than jump through loops with SQ. Once I am done with this task and have some spare time, I will try test if |
Should be improved with #2410 |
Describe the bug
Basically, see #2228. I ran
sonar-scanner
on our project over night, and it did not finish after 18 hours. I used this command:From my understanding, the scanner completely ignores the
compile_commands.json
file and tries to analyze everything there is in working directory. Unless I providedexclusions=
, I could see multiple parsing errors in unrelated files, like sources of ffmpeg that are checked our with our dependencies repo. It also does this in single-threaded mode.When using
-Dsonar.cxx.squid.disabled=true
, the scanner finishes in about 1-2minutes, but does not provide any syntax highlighting (as expected).Ways to improve the situation that I can see:
To Reproduce
Run scanner over several millions LOC, I guess?..
Expected behavior
The scan to complete in reasonable amount of time
Desktop (please complete the following information):
f267915ee0878040af16339f6e3e4bd4544ffe38
The text was updated successfully, but these errors were encountered: