How to enable SonarLint on all files in Visual Studio code

If googled, read some documentation, checked the settings, and obviously this forum, but I could not find it. So I hope someone can help me out:

How can I enable SonarLint for all files in a project in Visual Studio Code, and not only the files that are currently opened by de IDE (what seems to be the default behavior)?

Hello, thanks for your question!

This feature has not been implemented yet in VSCode, though it does exist in IntelliJ and Eclipse.

[Edit] This post erroneously mentioned this feature being available in Visual Studio.

Our current stance is that on-the-fly analysis brings much more user value than full-project (or folder) scan. However, we recognize that this need exists in some settings.

What would be your primary use case for “all files analysis” in VSCode?

@JBL_SonarSource hi Jean, you said this feature has been implemented in Visual Studio, so how do i enable this feature? i want to get the error report while code compiling, such as output them into the log file

Hello @judy, thanks for your question.

Sorry for my misleading message, I thought this feature was available in some form in VS but this is currently not the case. There is an open issue to support this for C++ projects though.

Would you mind sharing a bit more info about your need for this feature? E.g what would you do with the full list of issues, and what would be your expectations about its contents?

we want to integrate sonarlint into our CI not just in developer’s IDE, and when we build our product, we want to scan our code w/o opening all files, then we can get the report for all issues and try to fix, another purpose is that we want to generate a report to review the quality of the product code.

Thank you for the additional information!

In our ecosystem, analysis during CI and reporting would be a role fullfilled by SonarQube or SonarCloud, you might want to give them a try :slight_smile:

In Visual Studio (where I do .NET development) it is part of the build (thanks to Roslyn!), so you get all warnings at once. I love that!

For me the use case of getting all issues at once (for TypeScript in my case, but that should not matter I guess). I know SonarCloud would give such possibilities, but as I could not persuade (yet) to go for that option, I would like to have it offline as well.

Furthermore, when we decide lets fix all issues of type x (because we enabled the rule), it would be extremly useful to be able to navigate too all issues inside the IDE.

So a ‘big button’ in a menu would be sufficient for me. That being said, you as a product developer obviously should investigate what serves most your customers best. :slight_smile:

1 Like

Thank you for your insightful feedback! And yes, I confirm that we are definitely looking for such insights when building our roadmap :slight_smile: