If SonarQube fails, SonarLint should fail as well

Hello @Dexion and welcome to the Sonar community!

Ideally we would like SonarLint to tell you whether the new code you are going to commit will result in failing the Quality Gate during SonarLint analysis, and it something we are looking at for the future; we are not there yet, one of the reasons being that there are a few kinds of issues that SonarLint can’t detect yet (you can learn which ones here).
In any case, I am not sure whether failing the build in Visual Studio is the best option to inform developers that their code contains new issues that will fail SonarQube Quality Gate; other possibilities include displaying a pre-commit message in case of new issues or letting the user run an on-demand check. I would love to hear your thought on this.

In the specific case of S3776 (Cognitive Complexity) the issue is well reported by SonarLint and has a “Critical” default severity. As documented here, we map this severity to “Warning” rather than “Error” in Visual Studio exactly to avoid failing the local build. If you wish, you can change that by enabling Treat warnings as errors in your project properties in Visual Studio.