C++ analysis not working

Thanks for giving support for C / C++ projects in VSCode. I’ve checked it out today (3.4.0) and the following issues still persists for me:

  • Using a multi project VSCode folder yields to being able to either use compile_commands.json for project a or project b. It would be appreciated if multiple compile_commands databases could be used. This should not really be an issue due to absolute paths being used by compile_commands.json.
  • If configuring compile_commands.json for project a Sonarlint is still finding zero issues in any file. Is there a chance to get more debug information?

Could you please point out differences between analysis being done in Sonarlint VSCode extension and the full Sonarqube Scan on a hosted server?

Folder file:///project is now on branch work/sonarscan
[Info  - 06:13:42.783] Found 0 issues
[Info  - 06:13:52.683] Analyzing file 'file:///project/ProjectA/file.cpp'...
[Info  - 06:13:52.720] Found 0 issues
[Info  - 06:13:59.397] Analyzing file 'file:///project/ProjectA/fileb.cpp'...
[Info  - 06:13:59.425] Found 0 issues

Edit1:
Increasing verbosity in settings yields to the following:

[Info  - 06:25:59.356] 1 file indexed
[Debug - 06:25:59.388] 'JavaSensor' skipped because there is no related files in the current project
[Debug - 06:25:59.388] Execute Sensor: CFamily
[Debug - 06:25:59.390] Cached compilation database modified time did not change
[Debug - 06:25:59.390] Time to parse Compilation Database: 0ms
[Debug - 06:25:59.390] Probing compiler: [...]
[Debug - 06:25:59.402] stdout:

[Debug - 06:25:59.402] stderr:
execv: No such file or directory

The setup uses docker container to compile and work with the project.

Hello @aldagm,

I moved you to a separate thread.
I expect that you are facing the same issue like this one.

We currently expect the compiler path in the compilation to be a full path or relative to the “directory” entry. Is it in your compilation database?

We don’t support multiple compilation databases.
If you need to, it is fairly easy to combine them into one JSON file and point to the result.
We don’t do that automatically because:

  • It is easier for the users to do it based on their project structure. they can choose what to do with the intersection of the two JSON.
  • In many cases, it is not the right thing to do. multiple compilation database means different independent builds and independent project. You can switch between compilation databases instantaneously through the SonarLint embedded action.

If you still face the issue after this can you share with me the compilation database and the full logs?
I can send you a private message where you can upload them if you prefer.

Thanks,

hello @aldagm,

this should be solved in the latest SonarLint for VS Code release.

Thanks,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.