How to exclude a specific file from SonarLint scanning/analysis?

Hi there, I’m using SonarLint in VS 2022, and would like to exclude a specific (large header-only library) file from analysis, because it causes VS to freeze whenever I open that file in the editor (it takes maybe 15-30 seconds to analyze).

I’ve tried to find a setting for this in the SonarLint (for VS) options, have tried various “exclusion” entries in the per-user “rules settings” (settings.json) file, and have tried creating a sonar-project.properties file at the root of my project tree containing something like sonar.exclusions=**/hugefile.hpp, none of which excluded the file from analysis.

Is there a way to do it? Thanks.

Hi @totalgee - welcome to the community.

There is no way to do this currently in SonarLint for VS. It has been requested as a feature, so you might want to up-vote it.

Also, we have an open ticket about the performance of analysis on very large C++ files that you can track.

Thanks for the reply! I’ve done both the things you’ve suggested, and am glad to know these are “on the radar”.