There was a simliar question a few years ago which have been closed.
A use case is when you need to run through old projects that needs a cleanup or when you are just trying to run through the entire project to make sure you have fixed everything.
Having to open every single file of the project is extremely cumbersome and since such a feature exist in IntelliJ for example, why not do it for VS Code as well?
Old question How to enable SonarLint on all files in Visual Studio code
Thanks for your question. It’s very important one!
Sonar doesn’t recommend this approach because fixing all issues in existing project may be time consuming and can make you perform code refactoring you haven’t planned. And even if you will manage to reach the point where you have fully clean project. Then tomorrow your SonarLint will get an update with new rules and you will see new issues in files that were considered clean yesterday. So this approach will not allow you to have fully green project anyway, if you will keep your SonarLint up to date.
So workflow Sonar suggests called Clean as You Code. You can read more about it at the page, but idea is to make sure that the code you changing during your work on project is always clean. So since you adding new clean code and when you changing old code you ensure that result is clean - you getting your code base cleaner and cleaner over the time. And you don’t spend additional effort to achieve it, if you follow this principle.
In practice usually we work with some kind of version control system, most likely
git. So just make sure that each pushed commit has no issues on SonarLint side and every pull request passed Quality Gate on SonarQube/SonarCloud side.
So, as you see now, full code base analysis is not the focus of the Sonar products. It’s more about new and recently changed code. This being said, as mentioned in the topic you linked, SonarQube and SonarCloud offers the report of the full scan of the project. Also it’s possible to analyse multiple selected files (up to the whole project) in SonarLint for IntelliJ and Eclipse, but since it’s not a core feature we don’t have it in VSCode.
I hope it helps.
Well - it doesn’t really help at all.
We do Clean as you Code, but that doesn’t change the fact that a full local scan is very useful to bring old projects uptodate or verifying that we don’t have too many old errors still around.
But we will just spend more time - working harder, not smarter - sadly.
Then I would suggest you to post your idea to the Product Manager for a Day subcategory.
Since it’s not in the focus for the Sonar products because of the reasons discussed above, I can’t promise it will be a priority. But you will be able to present the idea of the feature, explain your pain points and use cases there. And this feature may be added to the roadmap after internal discussion.
I will do that!