Please provide
- Operating system: Windows 10 64bit
- SonarLint plugin version: v4.4.2
- Programming language you’re coding in: C++
- Is connected mode used: Yes and No, tried with both, currently just trying to use SonarLint locally
- Connected to SonarCloud or SonarQube (and which version): SonarQube Enterprise Edition Version 10.4.1
And a thorough description of the problem / question:
Hi!
I am trying to analyze a project using SonarLint and no problems are detected. The project has a custom build system, but I made a script that generates the correct compile_commands.json, that I feed into SonarLint.
The problem is, even with the highest level of verbosity, the vscode output for SonarLint shows this:
[Debug - 11:02:09.986] Execute Sensor: CFamily
[Info - 11:02:09.996] Parsing compilation database C:\source\directory\compile_commands.json
[Debug - 11:02:10.285] Time to parse Compilation Database: 295ms
[Info - 11:02:10.285] Subprocess(es) done in 298ms
[Info - 11:02:10.285] 0 compilation units analyzed
[Info - 11:02:10.285] Found 0 issues
What I assume must be the problem is the ‘0 compilation units analyzed’, showing that the file isn’t perceived as a compilation unit?..
My compile_commands.json structure:
[
{
"directory": "absolute\\path\\to\\directory",
"command": "absolute\\path\\to\\compiler <compiler arguments separated by space>",
"file": "absolute\\path\\to\\file",
"output": "absolute\\path\\to\\.o\\file"
},
{
"directory": "absolute\\path\\to\\directory",
"command": "absolute\\path\\to\\compiler <compiler arguments separated by space>",
"file": "absolute\\path\\to\\file",
"output": "absolute\\path\\to\\.o\\file"
},
...
]
Question 1: Is there a specific format required for the compile_commands.json on windows? I tried with both forward slashes ‘/’ and double backslashes ‘\’ for the paths and command, but no luck. The command works as expected when executing from a clean cmd and no environment variables are required.
Question 2: Is there any requirement for the compiler to be used? I tried the QNX compiler and the i686-w64-mingw32-gcc compilers, each with their respective arguments.