Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio C#-settings and StyleCop (MS Source Analysis)

Does anyone have settings for Visual Studio, in XML or a .vssettings-file, that is compatible with StyleCop?

I've used the book Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries for guidance on what Microsoft finds to be the correct way to format C# and set my Visual Studio-settings accordingly.

But when I use "Format Document" in Visual Studio, StyleCop will fire on all cylinders and complains on all sorts of things.

Some errors even seems impossible to set in the settings. Like curly braces should be on a new line, if something spans for more than one row.

like image 986
Seb Nilsson Avatar asked Dec 17 '25 16:12

Seb Nilsson


1 Answers

StyleCop for ReSharper would certainly help:

StyleCop for ReSharper is now feature complete in that is has reached feature parity with StyleCop 4.3.

There are 148 StyleCop rules.

  • 38 of these must be fixed manually (normally because you have to type descriptive text or rename variables).
  • Of the remaining 110 rules 58 are fixed by R# Code Cleanup (silent mode).
  • Of the 52 now remaining we have Code Cleanup rules that fix all of them automatically.

We also provide 106 Quick Fixes that provide in place context menu fixes for violations for the 110 rules that can be fixed automatically

We also ship a "StyleCop friendly ReSharper Code Style Sharing Settings file" which configures ReSharper to automatically format code in a StyleCop friendly manner.

like image 136
HowardvanRooijen Avatar answered Dec 20 '25 07:12

HowardvanRooijen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!