Issues downloaded from the server don't show in the VS Code

  • Operating system: Windows 11
  • SonarQube for VS Code plugin version: 4.15.0
  • Programming language you’re coding in: C++
  • Is connected mode used: SonarQube Cloud

Issues downloaded from the connected server don’t show in the IED. See the screen below:


I verified manually content of the issues file and it contains all the issues that exist on the server which is fine but the VS Code doesn’t show anything.

There are no errors in the output console.

Hi,

Welcome to the community!

What version of SonarQube are you connecting to?

 
Thx,
Ann

I am using the latest version of the SonarQube Cloud. I passed the SonarQube Server in the template by mistake.

Hi,

Thanks for that correction. I’ve flagged this for the team.

 
Ann

1 Like

Hello, thanks for reporting this.

Could you please:

  • Make sure that sonarlint.output.showVerboseLogs and sonarlint.output.showAnalyzerLogs are set to true in your VSCode user settings
  • Close all editor tabs
  • Reload the VSCode window (Command Palette > “Developer: Reload Window”)
  • Open the file(s) where you expect to see issues
  • Capture the contents of the “SonarQube for IDE” output (Command Palette > “SonarQube: Show SonarQube for IDE Output”)
  • Attach it here

Please make sure to capture the whole contents of the output, it should start with a line that says something like:

Executing ${JAVA_HOME}/bin/java -jar ${HOME}/.vscode/extensions/sonarsource.sonarlint-vscode-4.15.0/server/sonarlint-ls.jar -stdio -analyzers ${HOME}/.vscode/extensions/sonarsource.sonarlint-vscode-4.15.0/analyzers/sonargo.jar [...] ${HOME}/.vscode/extensions/sonarsource.sonarlint-vscode-4.15.0/analyzers/sonarlintomnisharp.jar

Thanks!

Hello, here is the log file.
SonarQube_for_IDE.log (536.4 KB)

BR

Hello, thanks for sharing the additional info!

I see the following sequence at the beginning:

[Debug - 10:02:34.395] [sonarlint : SonarLint Analysis Executor] Looking for node in the PATH
[Debug - 10:02:34.417] [sonarlint : SonarLint Analysis Executor] Execute command 'C:\Windows\System32\where.exe $PATH:node.exe'...
[Info - 10:02:34.451] [sonarlint : sonarlint-websocket-subscriber] Creating websocket connection to wss://events-api.sonarcloud.io/
[Debug - 10:02:34.662] [sonarlint : SonarLint Analysis Executor] Command 'C:\Windows\System32\where.exe $PATH:node.exe' exited with 1
stderr: INFO: Could not find files for the given pattern(s).
[Debug - 10:02:34.662] [sonarlint : SonarLint Analysis Executor] Unable to locate node
[Warn - 10:02:34.663] [sonarlint : SonarLint Analysis Executor] Node.js could not be automatically detected, has to be configured manually in the SonarLint preferences!

[...]

[Debug - 10:02:34.793] [sonarlint : SonarLint Analysis Executor] Plugin 'JavaScript/TypeScript/CSS Code Quality and Security' requires Node.js 18.17.0. Skip loading it.

The component that powers analysis of JS, TS and CSS in “SonarQube for VSCode” requires a Node 18.17+ runtime.

There should be a notification message about this at some point when the IDE starts:

You should find detailed information in the product documentation.

I noticed this information but ignored it. I am looking for a solution for the C++ files. I don’t want to analyze JS, TS, or CSS. You can see it in the logs, probably at the bottom.

BR

My bad, I did not read the initial message carefully enough :man_facepalming:.

I see that:

[Info - 10:03:03.365] [sonarlint : sonarlint-analysis-engine] Analysis detected 1 issue and 0 Security Hotspots in 17099ms

So this found issue is not highlighted in the editor and it does not appear in the “Problems” view?

Could you please share a screenshot of SonarQube Cloud that shows the expected issues?

Sure, here is the example.

SonarQube Cloud:


VS Code:

But it seems that those issues are downloaded properly:

SonarQube focus: overall code is enabled in the IDE.

Could you please check the “Problems” view?

The “SonarQube Issue Locations” view is only meant for additional locations from the “Show All Locations” code action (and I created a ticket to address this misleading UI in the next version).

Also, would you mind (privately) sharing the file where this issue should be found? I can open a DM channel for this.

Ah, sorry, forgot to mention about “Problems” view. There are no issues related to the SonarLint.
image

I can share it, but I need to remove product and enterprise-specific data.

How can I reach you?

A heads-up on the investigation (thanks a lot @RybaMaciej for helping us help you!):

  • One of the expected issues is suppressed in SQ:Cloud, so not seeing it in the IDE is by design :wink:
  • The other one is not detected at all in the IDE analysis :see_no_evil:; we’re trying to figure out which difference in the analysis process between Cloud and IDE causes this difference in the issues found.
1 Like

Hey :wave: after a discussion with the team responsible for the C++ analyzer, it seems that this discrepancy is an unfortunate, but expected consequence of how analysis is done in the IDE :confused:.

When the analysis runs on SQ:Cloud, the analyzer has access to the whole source code of the application, including header files. When it runs in the IDE, it currently only has access to the one file being analyzed (usually, the one currently open in the editor).

In the case of S4144, the duplication can only be detected in the IDE if the declarations are in the same file: if they are in a separate header file, it won’t be reported.

This has been noted for improvements in later versions, cross-file analysis is definitely an area where SQ:IDE can improve.

2 Likes

Hi!
Thank you for the clarification. I am waiting then for the future improvements. Fingers crossed!