Norway


Often when I write unit tests I use Console.WriteLine so  can see the output after the test execution. This can be a great time saver when tests fails.

image  - image - Donovan Brown | How to suppress SonarLint Analyzers rules in Visual Studio 2017

However, if you are using it will nag you to death about using Console.WriteLine.

First with a squiggle.

image  - image - Donovan Brown | How to suppress SonarLint Analyzers rules in Visual Studio 2017

So I use the light bulb to it.

image  - image - Donovan Brown | How to suppress SonarLint Analyzers rules in Visual Studio 2017

Even if I select for solution I have to do this a times because each instance targeted.

[

assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(“Minor Vulnerability”, “S2228:Console logging should not be used”, Justification = “<Pending>”, Scope = “member”, Target = “~M:Airlink.Core.UnitTest.ExportImportTests.ExportImport_Save”)]

How do I tell SonarLint once and for all that I do not care about this rule!

Expand your project in Solution Explorer. Now expand References and finally . Right-click on Analyzers and select Open Active Rule Set.

image  - image - Donovan Brown | How to suppress SonarLint Analyzers rules in Visual Studio 2017

There you can finally uncheck the that do not apply.  Be sure and save your changes.

image  - image - Donovan Brown | How to suppress SonarLint Analyzers rules in Visual Studio 2017

It took me forever to find that. I hope this saves you the pain this caused me.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here