[Opensim-dev] Proposal: OpenSim StyleCop compliance

Stefan Andersson lbsa71 at hotmail.com
Thu Sep 10 12:35:04 UTC 2009


Hey guys,

 

I've been working with Microsoft StyleCop compliance for legacy projects
lately, and wrote a blog about it:

http://lbsa71.net/2009/09/10/introducing-stylecop-on-legacy-projects-using-s
tylecop-for-resharper/

 

basically, StyleCop is a tool for enforcing Micrososft Source Analysis
recommended C# source code style.

http://code.msdn.microsoft.com/sourceanalysis

 

the rule set defines a coherent coding standard for C#.  One compilation of
these rules are here:

http://www.thewayithink.co.uk/stylecop/stylecop4_3rules.htm

 

Now, while I personally don't necessarily agree on all rules, they are all
described - some of them even have (good) motivations attached to them - and
I'd rather follow that set of rules than have no enforcement at all.

 

So, I propose we introduce the StyleCop ruleset as OpenSim code standard.

 

As I've outlined in the blog, doing this would fall into three categories:

.         Documentation

.         File Headers

.         Code

 

The two first ones are the bulk of the manual job, and can be considered
optional. I do believe that being StyleCop documentation compliant would
seriously raise the bar on OpenSim documentation. Optionally, we can exclude
documentation rules and work on them separately.

 

Regarding code, the "StyleCop for ReSharper" plugin can take care of the
bulk of the issues. What's left is basically renaming functions, fields and
doing some formatting that the automatic clean up fails to take care of.

 

One of the biggest impacts on code is the transition from "m_" to explicit
"this." and that commenting, regions and line break formatting is strictly
governed.

 

As you all know, I've been a proponent of "m_" but that's something I'm
ready to lay aside to achieve consistent code style. I also know that there
is reflecting code depending on the "m_" naming, but those projects can be
excluded until we can get a fix for that.

 

As StyleCop is implemented as a Visual Studio plug-in I guess code cleanup
will have to be a voluntary effort by the Visual Studio developers. This
proposal is more about embracing the StyleCop code style in itself. 

 

Best regards,

/Stefan

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20090910/486409de/attachment-0001.html>


More information about the Opensim-dev mailing list