# Failing a build in the IDE for new code violations

**URL:** <https://community.sonarsource.com/t/failing-a-build-in-the-ide-for-new-code-violations/89417>\
**Category:** Visual Studio\
**Created:** [March 7, 2023, 11:58am UTC](https://community.sonarsource.com/t/failing-a-build-in-the-ide-for-new-code-violations/89417 "2023-03-07T11:58:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OliB](https://avatars.discourse-cdn.com/v4/letter/o/ac8455/32.png) [@OliB](https://community.sonarsource.com/u/OliB)\
**Post date:** [March 7, 2023, 11:58am UTC](https://community.sonarsource.com/t/failing-a-build-in-the-ide-for-new-code-violations/89417/1 "2023-03-07T11:58:50Z")

</div>

We are using C# and would like to achieve something similar to the above. Currently I see warnings in the IDE which then require a CI run to fail the build on new code violations.

What is the recommendation here (if any) to improve that cycle time?

We are using SonarCloud in connected mode. I can change the rule severity but not with an option of Error (is that possible?). The severity options are info, minor, major, critical & blocker. A critical error in SonarLint is shown only as a warning in Visual Studio 22.

Any guidance on how to improve this would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![duncanp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/duncanp/32/293_2.png) [@duncanp](https://community.sonarsource.com/u/duncanp)\
**Post date:** [April 18, 2023, 1:30pm UTC](https://community.sonarsource.com/t/failing-a-build-in-the-ide-for-new-code-violations/89417/2 "2023-04-18T13:30:54Z")

</div>

Hi @OliB - welcome to the community.

I’ve split your post out to a new thread (please don’t post to existing threads, particularly ones that are several years old. Instead, start a new thread and if appropriate refer to the existing thread).

> [@How can I fail Build if SOnarLINT issues are reported](https://community.sonarsource.com/t/how-can-i-fail-build-if-sonarlint-issues-are-reported/27976/6):
>
> Currently I see warnings in the IDE which then require a CI run to fail the build on new code violations.
> 
> What is the recommendation here (if any) to improve that cycle time?

At present, your best option is probably to use the built-in VS “Changed Documents” filter in the `Error List`:  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/c/9/c996076f85d2dfa6046049111a6cd0512503223c.png)

However, that will show you all of the issues in the changed files, rather than the new issues since the last commit/new issues in the current working branch.  
We have a feature in the roadmap for this year to show only the new issues in the IDE i.e. the same issues that would be reported in a CI run.

> [@How can I fail Build if SOnarLINT issues are reported](https://community.sonarsource.com/t/how-can-i-fail-build-if-sonarlint-issues-are-reported/27976/6):
>
> We are using SonarCloud in connected mode. I can change the rule severity but not with an option of Error (is that possible?)

No, it is not possible. The mappings from Sonar severities to VS severities are shown [here](https://github.com/SonarSource/sonarlint-visualstudio/wiki#rule-severities). They are not currently configurable in Connected Mode. Most projects have many pre-existing issues, so we don’t want to set the severity to Error as that would prevent developers from building locally.

If you use standalone mode you can set the severities to whatever you like.
