[VS-CODE/CONNECTED-MODE] 403 error in SonarLint output while fetching issues for a single file

connected_mode
sonarlint
vscode

(Kartik Gola) #1

Hi,

This is with reference to my post on google group for which SLVSCODE-38 was logged.

Can you please reason about why issues for a single file are being fetched when the “batch issues” have already been fetched? I mean I get a 200 status code while it is fetching all issues from /batch/issues?key=<project_key>. Is it something else? Or am I missing something?

Thanks.


(Janos Gyerik) #2

Hi,

The idea is the following. The state of your local development environment and the state of the server are independent, disconnected. You may update the status of issues on the server, and the local environment will not know about that. To give a chance for the local environment to learn about changes on the server, we need to define some trigger events. Not so often to slow down the IDE, and not so rarely to be useless. What we commonly do in all flavors of SonarLint (Eclipse, IntelliJ, etc) is to re-download issues from the server on file open. Sure, if you have just updated the bindings and therefore fetched all issues, then it’s a bit of a waste. We don’t have sophisticated logic to be smarter there.

So then what’s the point of fetching all the issues at all, you might ask. It’s a fail-safe, in case you may have connectivity issues with the server. Then the previously downloaded issues will be useful.

Cheers,
Janos


(Janos Gyerik) #3

Hi again,

I have fixed the bug you reported. Would you mind to test it? You can install from this VSIX:

https://repox.sonarsource.com/sonarsource-public-dev/org/sonarsource/sonarlint/vscode/sonarlint-vscode/1.3.1-build.257/sonarlint-vscode-1.3.1-build.257.vsix

Thanks,
Janos


(Janos Gyerik) #4

The fix is released. We combined it with other features and called it 1.4.0, skipping 1.3.1.


(Kartik Gola) #5

Hi Janos,

I tested v1.3.1-build.257 and it worked fine! Thanks a lot!


(Kartik Gola) #6

Hi Janos,

I had a doubt regarding the batch issues being fetched. When I open a file from a VS Code project, I can see that SonarJS analysis is triggered on that file. Also, I see a batch/issues request for that file soon after the analysis is completed. I want to know if the squiggly underlines (linting) are performed using the just-run SonarJS analysis or the issues fetched from server ?


(Janos Gyerik) #7

Hi Kartik,

Thanks for testing, sorry I overlooked your responses after the release.

What we do is first perform the analysis as usual, and then try to match the issues with what we have on the server, so that we can exclude from the result if already marked resolved. To avoid slowness by making repeated requests to the server, we only fetch issues the first time you open a file, and we cache that to reuse in further analyses.

Cheers,
Janos