I am doing a pull request analysis. I am running sonarqube scan via jenkins pipeline and it generates a compilation database .json file, but no files are scanned. I have attached the sonar log. I can share the .json in private if you want me to do so.
The error message provides a checklist of things to verify:
Please make sure that:
* you are correctly invoking the scanner with correct configuration
* your compiler is supported
* you are providing the path to the correct Compilation Database JSON
* you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps
Since the error also says:
The Compilation Database JSON file was found
I think we can ignore the 3rd point, but the 4th point may be salient. Are you sure the paths in your compilation DB matched the paths analysis was seeing?
I think the paths are correct. The log initially states “5 source files to be analyzed” and “5/5 source files have been analyzed,” which aligns with the fact that the merge request includes 5 modified files. However, later in the log, it states “0 compilation units analyzed” followed by an execution failure. This contradiction between the two logs is confusing. I am adding the compilation json data file. final_compilation_commands.json (3.5 MB)
That logged file count is what the analyzer is seeing when it looks at the directory it was called in. What I’m asking is that you check the compilation database to make sure the paths in it match the paths the scanner is seeing.