To start, yes, I found this thread and this issue. From what I gather, SonarLint is still supposed to work if I create a dummy CMakeSettings.json
that points to my build directory.
But I’m striking out.
I can connect to our SonarQube server and download the ruleset; the .sonarlint
directory gets populated. I even get a message in the status bar that claims, SonarLint: Finished analyzing whateverfileimlookingat.cpp
.
But I get no actual output from SonarLint. (And the CI build analysis has quite a lot to say; so I don’t think SonarLint is lacking for things to talk about.)
I’ve got version 6.12.0.59751 of the SonarLint extension. Our SonarQube server is version 9.7.1.
My CMakeSettings.json
looks like this:
{
"configurations": [
{
"name": "v140-x64-RelWithDebInfo",
"generator": "Ninja",
"buildRoot": "C:\\Builds\\${projectDirName}\\${name}"
},
{
"name": "v140-x64-UnoptWithDebInfo",
"generator": "Ninja",
"buildRoot": "C:\\Builds\\${projectDirName}\\${name}"
},
{
"name": "v140-x64-Debug",
"generator": "Ninja",
"buildRoot": "C:\\Builds\\${projectDirName}\\${name}"
},
{
"name": "v140-x86-RelWithDebInfo",
"generator": "Ninja",
"buildRoot": "C:\\Builds\\${projectDirName}\\${name}"
},
{
"name": "v140-x86-UnoptWithDebInfo",
"generator": "Ninja",
"buildRoot": "C:\\Builds\\${projectDirName}\\${name}"
},
{
"name": "v140-x86-Debug",
"generator": "Ninja",
"buildRoot": "C:\\Builds\\${projectDirName}\\${name}"
}
]
}
In CMakePresets.json
, I have configuration presets with names matching the ones I’ve used in CMakeSettings.json
; and they all inherit this hidden preset:
{
"name": "windows",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Ninja",
"binaryDir": "C:/Builds/${sourceDirName}/${presetName}",
"installDir": "C:/Builds/${sourceDirName}/${presetName}/install"
}
compile_commands.json
is generated by the build and in the root of the build directory. Entries in it look like this:
{
"directory": "C:/Builds/MyProject/v140-x64-RelWithDebInfo",
"command": "C:\\PROGRA~2\\MICROS~1.0\\VC\\bin\\amd64\\cl.exe /nologo /TP -DNOMINMAX -DFoo_EXPORTS -I\"C:\\Users\\Me\\OneDrive - Company\\Source\\Repos\\MyProject\\src\\..\\include\" -I\"C:\\Users\\Me\\OneDrive - Company\\Source\\Repos\\MyProject\\src\\ntsim\\..\\..\\include\\foo\" -IC:\\Builds\\conan-data\\hdf5\\1.14.0\\Foo\\stable\\package\\644226a85741a02545333aad41154d94bc7cfceb\\include -IC:\\Builds\\conan-data\\hdf5\\1.14.0\\Foo\\stable\\package\\644226a85741a02545333aad41154d94bc7cfceb\\include\\hdf5 -IC:\\Builds\\conan-data\\zlib\\1.2.13\\Foo\\stable\\package\\93eb657c0bdc072eb70724d8e06fa2ea84bb3a99\\include /EHsc /we4251 /we4996 /Zi /O2 /Ob2 /Oi /DNDEBUG -MD /GL /Fosrc\\foo\\CMakeFiles\\Foo.dir\\sourcefile.cpp.obj /FdTARGET_COMPILE_PDB /FS -c \"C:\\Users\\Me\\OneDrive - Company\\Source\\Repos\\MyProject\\src\\foo\\sourcefile.cpp\"",
"file": "C:\\Users\\Me\\OneDrive - Company\\Source\\Repos\\MyProject\\src\\foo\\sourcefile.cpp"
}
Does SonarLint not like the disparity in directory separators between the fields? Is it having a problem with the spaces in the paths?