Interview Questions Headline Animator

Thursday, January 15, 2009

StyleCop and Good Code

So you are serious about your code quality huh... well StyleCop is a fantastic tool to ensure that. The best part is, it integrates with Studio 2008. It is simple.

  1. Go to This Location, click on downloads and download the latest version of StyleCop. As of now it is the version 4.3
  2. Install StyleCop. It asks you information about integration. Let it integrate with Studio for the moment.
  3. Fire up Visual Studio
  4. Click on Tools and say Run StyleCop and look at the 1001 warnings that StyleCop gives.

Now when you use StyleCop, most of the warnings are not what you really want to work upon. Like Documentation, for instance, imagewho cares whether there is a blank space line above a comment or not...? So you can go to Solutions Explorer and click on Style Cop Settings. This will bring up the "Microsoft StyleimageCop Project Settings" Dialogue box which will allow you to customize your rules set. Allow you to enable / disable rules as per your own special requirements / whims / fancies / moods... :)

It is a fun little tool and I could have written more about it but then I decided that I won't spoil the fun. You guys go ahead and explore.