Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling StyleCop rules

I'm using StyleCop. But there a couple of rules I want to ignore, for instance using this. in front of class members.

How do I turn off a StyleCop rule. I've looked but can't find how to do it.

like image 756
AJM Avatar asked Mar 13 '09 15:03

AJM


People also ask

Is StyleCop still used?

StyleCop used to be a Visual Studio plugin and a NuGet package. You can still use this in Visual Studio 2019, but the current recommended way to use StyleCop is to use the Roslyn-based analyzers.

What is StyleCop used for?

StyleCop is an open-source static code analysis tool from Microsoft that checks C# code for conformance to StyleCop's recommended coding styles and a subset of Microsoft's . NET Framework Design Guidelines.


1 Answers

In your StyleCop install, there's a Settings.StyleCop file. You can edit this to turn off rules globally. Drag that file onto the Settings Editor executable in that file to edit it.

You can also put copies of the settings file into your projects to override the global settings.

If you're using Visual Studio integration and not just MSBuild integration, you should be able to get to the settings editor on a per-project basis by right clicking on your project and choosing StyleCop Settings or something like that.

like image 172
bdukes Avatar answered Oct 28 '22 01:10

bdukes