First of all I am thanking all of the SonarSource community, especially SonarSourcers for helping out during difficult times.
SonarQube 9.1.0 version
What we are trying to achieve: is to analyze C code using multiple CMake output compile_commands.json of several to say modules/samples. See all of them analyzed in the server.
The problem: when passing each compile_commands.json one by one to the SonarScanner. Only the latest compilation data base can be seen analyzed in the SonarQube server, detected bugs from other samples gets removed.
What was tried: was to copy output from both samples of compile_commands.json files into one. This way I was able to see analyzed both code samples as one in the SonarQube server. However, this does not sound like a good idea.
The project structure is depicted down below. Each sample is being built separately, therefore has it’s own compile_commands.json file, which is later passed to SonarScanner. There are no samples, which consist of all includes.
Could you suggest what we could do in this situation?
A question from a side: is it possible to use unix command such as “nproc” to pass number of processors to parameter “sonar.cfamily.threads=” ? For example: sonar.cfamily.threads=$nproc. I was not able to do this. Is there any other way? Or should we input just an integer?
on my knowledge you are the first which is trying to combine them together, and at the same time Compilation Database support was recently added to the analyzer.
The same source can be repeated but the first one is going to be taken from the analysis. So, it is preferable to keep the order stable when merging multiple files, to keep the analysis result stable. I cannot think of other things you should be aware.