Cfamily analyzer not recognized by SonarQube for IDE in VS Code?

  • Operating system: Windows 11
  • VS Code version : 1.84.0
  • SonarQube for VS Code plugin version: 4.20.2
  • SonarQube CFamiliy analyzer version : 6.65.0.081949
  • Programming language you’re coding in: C/C++/Python
  • Is connected mode used: no

Hello,
I am trying to setup SonarQube for IDE for the first time in offline mode and I am having troubles getting de C/C++ analyzer to work.
On the left pane of my VS Code IDE I can see the SonarQube extension and rules for a lot of langages (including Python that I use) but no C/C++.

I made a few research (Offline installation - SonarQube for IDE Documentation - VS Code) and found out I needed to download CFamiliy analyzer and deploy it in a folder, which I did, but it still won’t show up in rules.
This path to my CFamily.jar file : ‘D:/user/.vscode/extensions/sonarsource.sonarlint_ondemand-analyzers/sonar-cfamily-version/6.65.0.081949/sonarcfamily.jar’
I also tried ‘D:/user/.vscode/extensions/sonarsource.sonarlint_ondemand-analyzers/sonar-cfamily-version/6.65/sonarcfamily.jar’ without success.

For the C/C++, I setup the path to my project compile_commands.json file exported by CMake, and these commands build the project without any issue.

I am falling short in term of new idea to get the C/C++ analyzer to work, so here I am asking for your help.

Thanks !

Hi,

Welcome to the community!

Could you share your log please?

 
Thx,
Ann

Sure, here it is :slight_smile:
sonarqube_debug_log.txt (69.3 KB)
Thanks,

Hi,

Thanks! I’ve flagged this for the experts.

 
Ann

Hello, thanks for the detailed report!

If I am not mistaken, the path to the offline download is almost correct:

According to what I see in the log, it should be something like:

D:/users/usr/.vscode/extensions/sonarsource.sonarlint_ondemand-analyzers/sonar-cfamily-version/6.65.0.81949/sonarcfamily.jar

The sonarsource.sonarlint_ondemand-analyzers folder should be next to the extension’s folder, and the 0 character before the 4th version item should be removed.

Hello, thanks for your answer !
I tried your suggestions :
Both sonarsource.sonarlint_ondemand-analyzers and sonarsource.sonarlint-vscode-4.20.2 are under d:/users/usr/.vscode/extensions.
The analyzer is located here : D:/users/usr/.vscode/extensions/sonarsource.sonarlint_ondemand-analyzers/sonar-cfamily-version/6.65.0.81949/sonarcfamily.jar.
But I still have the same warning at the start of the log file :[Warn] Embedded plugin not found : c.

Hello! :waving_hand:

Can you give it a try with version 4.22 of the extension and version 6.66.0 of the analyzer? Please make sure to reload the VS Code window after downloading the plugin in the correct place.

All the best,
Sophio

The offline installation instructions say that the path should be .../sonar-cfamily-version/...
however, this post: Getting "Fetch Failed" Error at SonarQube startup - #11 by JBL_SonarSource
says the path should be .../sonar-cfamily-plugin/... (note: plugin, not version)!
I have confirmed that it works for me - though it took me a long long time to realise the discrepancy, and was only able to be found by seeing that post, as the documentation is INCORRECT and the error messages even with all logging enabled is completely and utterly unhelpful!!

Also, note that, in my experience with working through ssh, the path should be .vscode-server/... rather than .vscode/...

That’s a nice catch @LyndenAtAACB , thanks A LOT!! :woman_bowing:

I will flag this to get our docs updated. :pencil:

All the best,
Sophio

The page is updated with the correct path for offline installation.

Thank you @LyndenAtAACB for letting us know, user feedback helps us keeps the docs up to date.

Hello,
Thanks a lot, you solved the problem ! :slight_smile: