Open the SAFacilitator and create/edit a new project as follows:



This creates an "empty" project without any information on the sources to be analyzed, the analyzers options and so on...

Save the project as follows (the SAFacilitator proposes to use as name of the file the name of the project and it is a "*.json" file):



Now use the previously generated compilation database file ("compile_commands.json") to insert into our project specific information on the files, directories, compiler options and the like.



and



If you now edit the project,  you can see that:



the "compile_commands.json" file has been read,



the information about files and directories has been acquired as well as



the information about the compilation (i.e. tools and options); let's save once again our project file.


The configuration information obtained from the "compile_commands.json" file cannot be used as it is now to properly run SonarQube and the Static Analyzers, in particular:

  1. the current collection of identified project directories may contain directories which are children of other directories in the collection (and this situation is not accepted by SonarQube) and
  2. the current compiler options may be suitable for the actual target compiler but not for the Static Analyzers.



The first problem can be solved either manually by editing the directories collection (yellow square in the above picture) or automatically by letting the SAFacilitator remove the redundant children (green square in the above picture). 



The second problem can be fixed by editing manually the compilation options. This can be performed at overall project level by changing the options in the form shown in the above picture and then propagating the changes to all files by pressing the "Normalize" button (blue square) ...


 

... or at file level by double clicking on a file and editing its specific options.


How is it possible to know if a given set of options are correct or not? Easy, you can follow this simple procedure:


  1. edit options;
  2. verify them by running the Static Analyzers from the SAFacilitator;
  3. iterate the above steps till the Static Analyzers do not generate any error.


More on this in Step 3 section.



Please Note: this video was recorded in May 2019, at that time Cppcheck was not able to properly process the the "compile_commands.json" file; now, May 2024, it is.



This is a video tutorial showing this step.