Need help on cpp scan for our source code

Hi,
We are using SonarQube Enterprise license edition with 10M LOC limit.
Details:
SonarQube Version: 9.9.2.77730
Database: Microsoft SQL Server
Database: Version 15.00.4322

As part of our Static code analysis, We are trying to analyze CPP code by following below official document.

What we achieved:

  1. We just completed a small POC (CLI Scan) as per given example project (GitHub - sonarsource-cfamily-examples/code: C++ repository with example project that is build and analyzed on large matrix of operating systems, build tools and ILMs.)
  2. We followed every step as per given instructions in given official document.
  3. till now we are able to build the code by using build wrapper command and able to scan the cpp code.
  4. this was possible whenever we placed the main.cpp(used from example project) file in our source code folder.

what we are expecting:

  1. Is main.cpp file is required in terms of clean build.
  2. Is there any way to build the all cpp code which is existed in different folder locations
  3. Since we have cpp code in different folder locations, we have to build the code separately and as expected bw-output folder will create in respective folder sections, So how we can map the bw-output folder path in sonar.project.properties file for multiple bw-output folder?

Issues till now:

  1. Sonar Scan execution was successful but we are not able to find bugs, codesmells and other issues in code, but only we are able to find duplications in that(see image).

Kindly analyze this question and revert back for any information required

Hi,

Welcome to the community!

What I take from this is that your project is the product of multiple, independent builds, one for each directory. If that’s the case, then that means multiple analyses, one corresponding to each build/directory.

How are you running your analysis? Is it all folders together or one by one, each with its own build-wrapper files?

 
Ann

Hi,
Thanks for your response.
Currently we are scanning thorough CLI mode. But as I said we have cpp code in multiple folders, I have selected only one folder in my repository for POC. I just build that code with build wrapper and mentioned the output directory(bw-output) in my sonar properties file.

is there any way to build all cpp code at one place?, because multiple folders have cpp code it is very difficult to manage the build and mentioning the path’s of bw-output directories in sonar properties file.

Hi @R_G1,

If you have several independent builds, and you want the result to be in a unique project, the easiest solution is to create a script that runs all builds, and use the build wrapper around this script.

1 Like