SonarLint findings different from SonarQube server

Hello everyone,

First, thank’s to the people that will help me on that topic :slight_smile: .

I noticed a strange behavior using SonarLint plugin for Eclipse CDT (v4.1.0.201901311043) with binding to SonarQube server (Version 6.7.5 (build 38563)). Language used is C for the source files.

The findings on some files are different (sometimes exclusive). Let me give you an example:

Sonarqube findings vs SonarLint findings (same file):
/* edit removed image */

You can see that the findings are exclusive. Some are not found with SonarLint but in SonarQube and vice versa.

Fun fact, if I change the file extension in “.c” instead of “.h” of the given example, On-The-Fly feature of SonarLint finds the issues present in SonarQube.

My question is: what is missing/wrong in my configuration? Is there something I’m not aware of to get it work correctly?

Thank you

Loïc

Hello @LAn,

what version of the C/C++ analyzer do you have installed? Can you make sure you updated SonarQube bindings?
There might be some differences depending on your Eclipse project settings if it doesn’t pass correctly the configuration to SonarLint.
Could you please enable SonarLint verbose log and provide me such log? Thank you.

See this similar thread: Different results for SonarLint 4.1.0 vs. SonarCFamily 6.1 plugin

Hello Massimo,

Thank’s for your answer. Unfortunately, I cannot send you the console output for confidentiality reasons, however, I managed to solve the problem.

I didn’t know how the Sonarlint verbose feature, it helped me findout the problem, so thank you for that.

For those who are in the same situation, my problem was:

  • Sonarlint was unable to find a file that was included (information gotten from Sonarlint console verbose mode activated)
  • It seems Sonarlint needs the include file list set in Eclipse project properties -> C/C++ General -> Paths and Symbols -> Includes tab. This list was up to date in my project
  • The tool chain editor set in Eclipse project settings (C/C++ Build -> Tool Chain Editor -> Current toolchain) does have an impact on Sonarlint analysis. I changed from my Toolchain to Cross GCC.

It works!

Thank’s again Massimo, I hope it will help other users.

1 Like

Thank you for your update @LAn, I am glad you could solve your issue, if you ever going to need help in the future we have private messages to share private logs, no need to share them publicly.