Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone created any cool rules for FxCop/StyleCop?

I'm just looking for some inspiration. Especially in the area of performance and security, naming conventions are important but not as 'cool' ;)

Even if your rule was only applicable to your domain/project but demonstrates how powerful a rule can be, please let me know.

I work with C#, but I'm interested in rules for any language.

like image 545
tpower Avatar asked Jan 30 '09 09:01

tpower


2 Answers

In my experience, the developers that have started out creating custom rule sets for FxCop, usually give up after pulling out much hair. It seems like a great idea, but the pain is just not worth the effort.

like image 110
Mitch Wheat Avatar answered Nov 03 '22 01:11

Mitch Wheat


An alternative to the mess of writing FxCop custom rules would be to use the commercial tool NDepend. With this tool one can write Code Rule over LINQ Queries (namely CQLinq). Disclaimer: I am one of the developers of the tool

More than 200 code rules are proposed by default, these include naming conventions, design, architecture, code quality, code evolution, dead code, .NET Fx usage...

CQLinq is dedicated to write code rules that can be verified live in Visual Studio, or that can be verified during build process and reported in an HTML/javascript report.

The strength of CQLinq over FxCop API or other tools, is that it is straightforward to write a code rule, and get immediately results. Facilities are proposed to browse matched code elements. Concretely this looks like that:

CQLinq code rule

like image 22
Patrick from NDepend team Avatar answered Nov 02 '22 23:11

Patrick from NDepend team