Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# check or force naming conventions

I have inherited a few programs from a previous developer who was a little sloppy with naming variables, methods and classes with different capitalization and sometimes underscores.

Is there a program or a way in visual studio to validate the naming of each variable, method, property, constant, class.... I would be fine with the standard C# conventions.

like image 376
PeteT Avatar asked Apr 20 '09 15:04

PeteT


2 Answers

You could look at Microsoft StyleCop and FXCop

like image 128
jfclavette Avatar answered Oct 02 '22 12:10

jfclavette


I use ReSharper 4.5 for that, which has this advantage, that it allows you to see non-comforming code as you write it.

You also can use NDepend and CQL to check your conventions in a very granular and flexible way. It's great as part of your build script.

Both tools cost money, both are worth it.

like image 38
Krzysztof Kozmic Avatar answered Oct 02 '22 12:10

Krzysztof Kozmic