views:

468

answers:

5

I just downloaded the ASP.NET MVC beta and the templates are not StyleCop compliant.

Why is new .NET code coming from Microsoft not StyleCop compliant?

+9  A: 

Microsoft isn't monolithic. Different groups in it will have different opinions on how important the StyleCop warnings are. A lot of people would prefer to release sooner than fiddle about changing things that don't make all that much difference.

Also, StyleCop isn't right all the time. Sometimes the best thing to do with a warning is to ignore it.

Khoth
A: 

Most if not all Microsoft templates, in Visual Studio, are not Style copy complaint.

Nick Berardi
+4  A: 

StyleCop checks conformance to the Microsoft Framework Design Guidelines.

The guidelines are enforced only on the code that makes up the .NET Framework proper, and even in the framework proper, occasional lapses exist. Elsewhere, the guidelines are recommendations only.

The framework design guidelines are available as a printed book, and make very interesting reading for the annotations from the contributors on why and how they agree or disagree, and how best to apply and interpret the rules. I should point out several important facts:

  • Not even the people who wrote the guidelines agree on all of them.
  • You probably aren't writing a framework for release into the wild.
  • The guidelines are a work in progress, and StyleCop lags behind them.
Peter Wone
+1  A: 

Some thoughts about being compliant with style cop:

  • Style cop has rules that are good in general.

  • There are situations when the general rules are not good enough for the particular case or don't make sense.

  • Take for example Microsoft XNA framework, that framework breaks so many rules that makes FXCop scream. But they have absolute legitimate reasons to break them, like performance and portability.

  • Style cop rules are Recommendations, not Laws, breaking them comes down to reasoning of what brings most benefits for the situation: following the rule and being standard and familiar or, or breaking the rule for the specific reason your situation dictates and have other benefits from doing so.

  • Rules change. Something has to drive change.

So, Microsoft MVC team is free to be Style cop non compliant if they feel it's a good thing to do so.

P.S. Breaking the rules for no good reason what so ever isn't a good thing.

Pop Catalin
A: 

You may as well ask why most Microsoft applications don't follow the Microsoft Usability guidelines.

MS is a large company and like all large companies they usually don't follow their own rules.

Chris Lively