How to exclude folders from sonarlint scan


I’d like to exclude some folders from sonarlint in vscode. I couldn’t figure out how to configure it. Any help?


Hello, welcome to the community! And thank you for your question.

As far as I can tell, this feature is completely missing from SonarLint for VSCode (although it exists in some form in other IDEs).

I moved your post to the “New features” category so that other users can vote for it and give us additional insights.

In your particular case, what kind(s) of folder(s) would you want to exclude from analysis?


I would like to exclude the target/ folder from SonarLint, which contains code that is auto-generated by tools e.g. Protobuf and JOOQ.

Thank you for the additional details!

Are you using Maven, or maybe Gradle? I believe that in such a case, SonarLint should be able to query the project configuration from the build tool and automatically exclude the target directory.

Please also note that in recent versions of SonarLint for VSCode, and if you are using git, files matched by the .gitignore shouldn’t be analyzed either; and depending on your project context, one could consider that generated files should be ignored by the SCM anyway.