FXCop, a .NET code analyzer
I tried out FX Cop today and was quite impressed.
For those not aware of it (and neither was I until a couple of days ago) it’s a "Microsoft Best Coding Practices" reporter which takes a .NET assembly and reports on how it conforms to those practices.
It’s available from http://www.gotdotnet.com/team/fxcop/
There is an article on CodeProject on how to extend FXCop:
Why FxCop?
- To ensure that coding standards such as naming conventions, localization etc. are as per company standards.
- To avoid bad coding and make use of best practices.
- Well-formatted test reports.
FxCop allows you to write / create your own rules or to use standards provided by Microsoft, and apply to your assembly. A rule is managed code that can analyze targets and return a message about its findings. FxCop analyses programming elements in managed assemblies and provide an informational report containing messages about the targets, including suggestions on how to improve the source code.
Coding standards: all developers are supposed to follow a company’s coding standards. It’s not an easy task to check manually the thousands of lines of code to ensure that coding standards are followed or not. FxCop solves this problem. You create an assembly having all these standards and run your assembly (DLL or EXE) against these rules, and FXCop will ensure that the specified rules are used in the coding or not.
Darwen at CodeGuru describes it this way: