Is there a way I can set up Visual Studio 2019 builds to fail if there are any SonarQube warnings reported by SonarLint?

I’m ONLY intersted in SonarLint/SonarQube warnings. I’m aware that the project has a setting for “Treat warnings as errors” but if i set this to all then it will include non SQ warnings. I can specify the warnings but does that mean I have to list every single “S####” error code?

Is there a better way to accomplish this?

Bump :slight_smile:

Hello @edgar_CC, welcome to the community :wave:

I apologize for the delay, I missed your post.

Unfortunately there is no clean way to accomplish that.
Here are some options:

  1. Turn on “Treat warnings as errors” and then combine it with “WarningsNotAsErrors” for all non-SQ rules.
  2. Turn on “Treat warnings as errors” and add a ruleset file that disables all non-SQ rules (i.e. from Microsoft.CodeAnalysis).
  3. Whitelist SQ rules in “WarningsAsErrors”.

You can read more about these options in the official MS documentation.

Let me know if that answered your question.