views:

929

answers:

3

We're going to be integrating StyleCop into our build system in a couple of weeks. Trolling the web gave me some nice ideas for custom rules that could come in handy, such as a rule for filtering for profanity and sorting your members alphabetically (love this one).

Have you written any custom rules? What are they?

+4  A: 

Haven't written any Custom StyleCop rules per se, but did write StyleCop for ReSharper which helps identify and fix StyleCop problems automatically. If you do write some custom rules, you could also try writing some custom fixes for StyleCop for ReSharper to make your life easier!

HowardvanRooijen
This is a fantastic tool Howard, really good work!
Troy Hunt
+3  A: 

I have written a few custom StyleCop rules, of which one checks for trailing whitespace and another one checks if line lengths exceed a certain amount of characters.

I have published them here (GPLv3), if you want to take a look.

Christian
A: 

Hi,

I have just come across this analysis tool and really want to benefit from it.

I need to create 3 rules:

* A rule to pick up hardcoded URLs in a string literal, eg. str = "www.microsoft.com"
* A rule to pick up redundant using directives, eg. using System.Core (and this is not used)
* A rule to pick up large blocks of commented code 

Any help or guidance would be really appreciated.

Thanks,

Navin.

Navin
This should have been made its own question, not an answer in this question.
Bernard