Hello,
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.
project
|
└──samples
| |
| └───GNSS
| | └───gnss_sample_main.c
| | └───CMakeLists.txt
| | └───build
| | └───compile_commands.json
| └───USB
| └───usb_sample_main.c
| └───CMakeLists.txt
| └───build
| └───compile_commands.json
|
└───includes
| |
| └───gps.h
| └───glonas.h
| └───clock.h
| └───led.h
|
└───components
|
└───drivers
| └───gnss_driver.c
| └───usb_driver.c
|
└───services
└───service_1.c
└───service_2.c
- 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?
Ovidijus