SonarLint scanning all the files in the project instead of just the open ones

Please provide

  • Operating system: Windows
  • SonarQube for VS Code plugin version:4.15.0
  • Programming language you’re coding in: Apex
  • Is connected mode used: Yes with SonarQube server 10.8
    • SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?):

And a thorough description of the problem / question:
SonarQube for IDE is scanning all the files in the project for issues instead of just the open ones. This is causing performance issues. Updating and Re-installing SonarLint did not work.

VSCode v1.96.4

Hi,

Could you share your logs?

 
Thx,
Ann

SQlogs20250205141752.zip (9.7 MB)
These logs were pulled when almost half of the repo was scanned.

1 Like

Hi,

Thanks for the logs! I’ve flagged this for the team.

 
Ann

Hey there, @Yadhu. :wave: Thanks for reporting this!

SonarQube for IDE analyzes all files that are open in the editor. To achieve this, we rely on the textDocument/didOpen notifications sent from the IDE to our language server. Based on your logs, I am almost sure that one of the extensions (possibly an APEX-specific VS Code extension) is triggering such didOpen events for all (or a certain subset of) .cls files in your project. SonarQube for IDE tries to double-check whether these files are actually open or not, and that’s why there are a lot of log lines saying the analysis will be skipped for files not open in the editor. Unfortunately, we currently don’t have a 100% precise heuristic to determine whether the file is actually open in the editor or not.

To double-check this, you could drop "sonarlint.trace.server": "verbose" line in your VS Code USER settings file, restart VS Code and observe textDocument/didOpen events appearing in the logs.

TL;DR; What we are actively working on (literally as we speak) is improving the performance of analysis. You should be seeing continuous improvements in the upcoming versions.

I hope this helps,
Sophio

1 Like