Microsoft StyleCop: Source Code Analyzer for C#

Here is a cool internal tool used by Microsoft that is now seeing daylight Smile.

 

"We are very excited to announce the release of a new developer tool from Microsoft, Source Analysis for C#. This tool is known internally within Microsoft as StyleCop, and has been used for many years now to help teams enforce a common set of best practices for layout, readability, maintainability, and documentation of C# source code.

StyleCop is similar in many ways to Microsoft Code Analysis (specifically FxCop), but there are some important distinctions. FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.

The ultimate goal of StyleCop is to allow you to produce elegant, consistent code that your team members and others who view your code will find highly readable. In order to accomplish this, StyleCop does not allow its rules to be very configurable. StyleCop takes a one-size-fits-all approach to code style, layout, and readability rules. It is highly likely that you will not agree with all of the rules and may even find some of the rules annoying at first! However, the majority of teams using this tool within Microsoft have found that after a short adjustment period, they came to appreciate the rules enforced by StyleCop, and even began to find it difficult to read code not written in this style. 

StyleCop comes with a set of default rules analyzers covering approximately 200 best practice rules. These rules are fully compatible with the default layout settings in Visual Studio 2005 and Visual Studio 2008.

Specifically, these rules cover the following, in no particular order:

  • Layout of elements, statements, expressions, and query clauses
  • Placement of curly brackets, parenthesis, square brackets, etc
  • Spacing around keywords and operator symbols
  • Line spacing
  • Placement of method parameters within method declarations or method calls
  • Standard ordering of elements within a class
  • Formatting of documentation within element headers and file headers
  • Naming of elements, fields and variables
  • Use of the built-in types
  • Use of access modifiers
  • Allowed contents of files
  • Debugging text

After installation, StyleCop can be run from within the Visual Studio IDE, and can also be integrated into MSBuild-based command line builds" (Microsoft StyleCop).

Download ( Microsoft StyleCop )


Posted Jul 21 2008, 02:15 AM by Blake Niemyjski |
Filed under: ,


Comments 

Recent URLs tagged Contents - Urlrecorder Posted on Dec 20 2008, 12:01 PM

Pingback from  Recent URLs tagged Contents - Urlrecorder

Tiburon Chevrolet, 2005 Accent Headlight Hyundai Tiburon Posted on May 20 2010, 10:29 AM

Pingback from  Tiburon Chevrolet, 2005 Accent Headlight Hyundai Tiburon

1997 Bmw 3 Series 318i, 323is Dealers Bmw 318i Posted on May 20 2010, 05:45 PM

Pingback from  1997 Bmw 3 Series 318i, 323is Dealers Bmw 318i

1965 Chevelle Glass, 67 Chevelle For Sale Posted on May 21 2010, 12:56 PM

Pingback from  1965 Chevelle Glass, 67 Chevelle For Sale

C360 Rent, C36 Movie Posted on May 21 2010, 01:51 PM

Pingback from  C360 Rent, C36 Movie

280sl Tube 1969 Mercedes Benz, Mercedes Benz 280sl Price Auto Parts - 396.jeepsunlimted.com Posted on May 22 2010, 08:27 PM

Pingback from  280sl Tube 1969 Mercedes Benz, Mercedes Benz 280sl Price Auto Parts - 396.jeepsunlimted.com

Mitsubishi Challenger Comparison, Challenger Model Check Out - 276.dlmreza.net Posted on May 24 2010, 05:24 AM

Pingback from  Mitsubishi Challenger Comparison, Challenger Model Check Out - 276.dlmreza.net

Testors Aztek A778, Used Aztek Problems Pontiac Sunrunner - 200.akemet.com Posted on May 24 2010, 09:19 AM

Pingback from  Testors Aztek A778, Used Aztek Problems Pontiac Sunrunner - 200.akemet.com

Auction Landrum D450 Side Spring, Gl450 Full Mercedes Benz Gl Land Rover Range Rover Sport - 463.ja3ra.com Posted on May 24 2010, 09:36 AM

Pingback from  Auction Landrum D450 Side Spring, Gl450 Full Mercedes Benz Gl Land Rover Range Rover Sport - 463.ja3ra.com

2000 Mercury Mountaineer Recall Ford Explorer, Mountaineer Boiler Virginia - 130.akemet.com Posted on May 25 2010, 04:46 PM

Pingback from  2000 Mercury Mountaineer Recall Ford Explorer, Mountaineer Boiler Virginia - 130.akemet.com

windowscoding.com;
Copyright © 2008 Windows Coding
Microsoft and Microsoft logo's are trademarks of Microsoft Corporation.