No SonarLint C/C++ analysis in CLion

Please provide

  • Operating system: macOS 12.4 (on Apple Silicon)
  • SonarLint plugin version: 6.7.0.45926
  • CLion 2022.1.2 Build #CL-221.5787.29
  • Is connected mode used: Connected to SonarQube Developer Edition Version 9.2.4 (build 50792)

I have a fairly large legacy C codebase that I’ve loaded in CLion as a compile_comands.json project. If I open any .c file SonarLint says “No analysis done on the current opened file” with an additional warning that says “This file is not automatically analyzed - Some files are not automatically analyzed. Check the SonarLint debug logs for details.”

It’s not clear to me if the Log tab in the SonarLint panel is the “debug logs”, but it says:

Plugin 'secrets' embeds dependencies. This will be deprecated soon. Plugin should be updated.
Cannot start the SonarLint server on 64120
Server started on 64121
Sync quality profiles...
Downloaded plugin list in 31ms
[SYNC] Synchronizing analyzer configuration for project 'project-name'
Downloaded settings in 27ms
[SYNC] Active rules for 'c' are up-to-date
[SYNC] Active rules for 'cpp' are up-to-date
[SYNC] Synchronizing project branches for project 'project-name'

Pressing the green “play” button in the SonarLint tab does not appear to do anything.

I have the project bound to a SonarQube project, and the binding appears to work properly (it authenticates and gives me the expected list of projects to choose from). I do not get any SonarLint results whether the project is bound our not though.

If I create a toy (one source file) CMake project SonarLint does appear to work properly for the toy project.

FWIW I’m also able to use the SonarLint VS Code plugin in VS Code in my legacy C codebase as expected. I think that I’ve had SonarLint working in CLion with this codebase sometime in the last 6 months, but I can’t be certain as I’ve had to switch computers and IDE’s a couple times.

Hey there.

Welcome to our community! You can turn on verbose logging here.

Thanks for the reply, the verbose logging doesn’t tell me much more unfortunately, after turning it on and triggering an analysis again I get this:

Trigger: ACTION
[Action] 1 file(s) submitted
File 'theFile.c' excluded: OCFile:theFile.c not in project sources

AFAICT the project is working in CLion. Is it expecting a sonar-project.properties or do I need to explicitly point it at the compile_commands.json somehow?