Using SonarLint how can I make warnings into compiler errors

  • Operating system: Windows
  • IDE name and flavor/env: VSCode, VS, C#, TypeScript

I want to make SonarLint warnings turn into compiler errors.
I dont want to right click on every warning and make it into error locally, I need to do it so when people bind the project from SonarCloud to Sonarlint that the configuration changes so that per SonarCloud project some warnings/all are treated as compiler errors.

I tried using Quality profile but when I updated SonarLint to newest version now when I bind a project from SonarCloud to Sonarlint I dont get no new configuration files and nothing changes.

Currently I tried that in VSCode and VS and I am having problems… I have a SonarCloud project that has a Quality profile where I changed some warnings to blockers and then I make a Push to the main branch so that quality profile updates on the project. Then when I try to bind the project again or refresh the bindings nothing happens and warnings are still warnings and not compiler errors…

Hi @KresimirK,

as a hint for you: When you’re using SonarLint (on any IDE) in connected mode, the configuration regarding rules and issue severity is loaded from the connection, in your case SonarCloud.

If you’d like to have a configuration you can provide to every user, it has to be done on SonarCloud as the local changes will be ignored when they bind their project.

Can you also please elaborate on what you mean by turning SonarLint warning into compiler issues? Do you want a local compilation (e.g. via MSBuild) to fail based on the SonarLint issues found?


I want to make change to some rules in the SonarCloud Quality profile of C# and make it so that when you connect to that SonarCloud project with SonarLint you get errors in the compiler instead of warnings.

I already made my custom Quality profile for C# that has a rule S1144 to have Blocker severity instead of Major severty. Shouldnt that give me an error instead of warning in my Visual studio compiler?

Maybe I am doing it the wrong way. How should I make it so that when a developer from my team connects his SonarLint with a SonarCloud project that he gets compiler errors instead of compiler warnings for specifics rules (like that S1144).

For now I made a quality profile and changed the severity to Blocker and connected my SonarLint to that SonarCloud project and it didnt work.

If you could help me with this I would appreciate it so much. If you need more info or pictures please ask me. Thank your for your time!

Hi @KresimirK

We do not show SonarLint issues as errors as a design choice. If you think this would be valuable you could suggest this at Product Manager for a Day section of our forums.

As a workaround, you could enable TreatWarningsAsErrors but please note that this will fail the build for all warnings not just Sonar rules.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.