In a project, some issues marked as Accepted (won’t fix) disappear from VSCode editors and problems tab (probably issues tab in english?), but some others still displayed at both.
I don’t know why just some of these fixes work perfectly and others don’t. And I don’t know where to look to understand and solve the problem.
I searched in the SonarQube for IDE output, but I don’t know exactly what to look for…
How can you help me? What information do you need?
When I fix problems and only after running an analysis, the problems are removed from VSCode. But, if I fix a problem before the analysis, and, of course, even if the file has not changed (but has been resaved), the problems are not reported in VSCode. It seems that there is some kind of file signature between VSCode and SonarQube and if the analysis has not been launched, the problems are not reported.
Some of my files are automatically saved, for example when a format is launched. That is the reason why I do not think to launch an analysis.
So now I have a new problem… How is it possible to indicate that the fixed problems are in the current file and not in the old one?
Maybe I was not explicit. Feel free to ask for explanations.
Thanks!
Oh… I tried to reopen the issue, to analyse the project code again and to fix the problem afterwards, but that doesn’t work either.
When you bind your local project to a remote project on SonarQube Server, SonarQube for IDE will try to match the local issues with the remote ones, and silence those that have been silenced (either Accepted or reported as False Positive) on the server. When you change issue status on the server, SonarQube for IDE is supposed to get near-real-time updates with the new status, and muted issues should disappear locally as well.
If the file contents locally significantly differ from those on the server, it is possible that SonarQube for VS Code does not understand that it is the same issue that was silenced on the server.
Does that clarify? In case you would like us to investigate further, we would need SonarQube for IDE logs.
Thank you for your answer. You confirm what I was thinking : all issues should be synchronized between the server and files unless there are significant differences between them.
But in my case, files are identical. They are simply resaved after automatic formatting. And in this case, the formatting had already been done. The files are therefore strictly the same. The only thing I forgot to do is analyze the project before fixing the issues on the server. In one file, I even fixed some issues before analysing, and the issues didn’t sync, and I fixed some issues after analysing and those issues synced correctly.
I ended up deleting the project on the server and the sync on VSCode, then recreating both (without changing the key). And there… two surprises. First, the issues are still stored in the database (although the project has been deleted) and VSCode hides the old fixed issues exactly as before (the ones that were already hidden remained hidden and the ones that were still showing are also hidden). It seems that deleting the project does not delete the fixes and others in the database. But that’s another problem. And secondly, from now on, I don’t have any problem that is marked as solved on the server. It seems that the server keeps in base the project (with the same key) and the fixed issues, but does not display them on the server’s web page.
So…
I will have to recreate a new project with a new key to fix this.
Anyway, I just spent an hour doing a series of tests and I can’t reproduce my problem. Sometimes VSCode doesn’t report some resolved issues, but restarting VSCode or doing a synchronization is OK. It annoys me that I can’t reproduce this state…
Thanks again for helping me, I’ll get back to you if I encounter this problem again.
However, if you want the logs, tell me which ones you want, I’ll send them to you. Thanks!
The only thing I forgot to do is analyze the project before fixing the issues on the server. In one file, I even fixed some issues before analysing, and the issues didn’t sync, and I fixed some issues after analysing and those issues synced correctly.
I am sorry I don’t fully follow this scenario So, you have a file with issues. The issues appear on both SonarQube Server, and IDE. Now, you “fix” some of the issues on the server (mark them as Accepted or False Positive). By now, you expect those issues to disappear from IDE as well - this is a correct expectation. On the other hand, if you actually fix some issues in the IDE - change the code and the issue disappears, you will need to re-run server analysis for the issues to disappear on the server too.
Also, you might find it helpful that there is a possibility to mark issues as Accepted or False Positive directly from the IDE when you are in Connected Mode. The docs are here.
What I would suggest you to do if you want to start again from scratch is - have a project ready on the SonarQube Server in the state that you expect it to be. Locally,
Remove connection settings
Remove all the ~/.sonarlint/known-findings-store-* and ~/.sonarlint/storage folders.
Restart VS Code
Recreate connection and binding to your Server project
Hopefully, this should put you back in a fresh state. It is impossible to tell without the logs but possibly the local issue storage got messed up at some point?
I hope I did not confuse you even more
Thank you very much for your trust and patience,
Sophio
I am sorry I don’t fully follow this scenario So, you have a file with issues. The issues appear on both SonarQube Server, and IDE. Now, you “fix” some of the issues on the server (mark them as Accepted or False Positive). By now, you expect those issues to disappear from IDE as well - this is a correct expectation.
Yes, that’s exactly what I expected and unfortunately what didn’t happen!
I didn’t know about the trick to mark issues as accepted or false positives directly from the IDE. I’ll look into that very carefully!
Thanks for the procedure. Now I created a new project and everything works. But it’s still good to know.
And as they say here: Merci beaucoup ! Passez un bon week-end !
I had again the above problem. I don’t exactly why this problem occurs, but, your solution (remove all the ~/.sonarlint/known-findings-store-* and ~/.sonarlint/storage folders.) works perfectly !!!