Introducing FxCop Practical Help for Code Reviews
Background <ul><li>FxCop is used to analyze code based on the generated assembly regardless of the language </li></ul><ul>...
Agenda <ul><li>The need for Code Validation </li></ul><ul><li>Using FxCop </li></ul><ul><li>Interpreting the Results </li>...
Why Code Validation <ul><li>Ensure adherence to standards </li></ul><ul><li>Ensure consistency </li></ul><ul><li>Ensure fo...
Coding Standards <ul><li>There are established standards for Class Library Developers </li></ul><ul><ul><li>http://msdn.mi...
Using FxCop <ul><li>Start the Utility </li></ul><ul><li>Select Assemblies to validate </li></ul><ul><li>Add custom rules i...
Interpreting the Results <ul><li>Add the “New” Column to track whether an issue is new or not </li></ul><ul><li>Navigate t...
The Standard Rules <ul><li>Design Rules </li></ul><ul><li>Globalization Rules </li></ul><ul><li>Interoperability Rules </l...
Creating Your Own Rules <ul><li>Introspection SDK is not documented! </li></ul><ul><li>Use Reflector to review existing ru...
Fitting FxCop Into Your Life Cycle <ul><li>FxCopCmd is command line utility </li></ul><ul><li>Add FxCopCmd as an External ...
Adding FxCop as an External Tool
Using FxCop Reports <ul><li>Specify a Style Sheet for the Report </li></ul><ul><li>“ Save Report As” from the File Menu </...
Summary <ul><li>FxCop is used to automate the code review process </li></ul><ul><li>FxCop includes rules for detecting ove...
Where to Get More Information <ul><li>http://aspnet.4guysfromrolla.com/articles/060204-1.aspx </li></ul><ul><li>http://www...
Upcoming SlideShare
Loading in...5
×

Introducing fx cop

1,478

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,478
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
62
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introducing fx cop

  1. 1. Introducing FxCop Practical Help for Code Reviews
  2. 2. Background <ul><li>FxCop is used to analyze code based on the generated assembly regardless of the language </li></ul><ul><li>Automate validation of established standards </li></ul><ul><li>Create rules to validate custom standards and guidelines </li></ul>
  3. 3. Agenda <ul><li>The need for Code Validation </li></ul><ul><li>Using FxCop </li></ul><ul><li>Interpreting the Results </li></ul><ul><li>Reviewing the Existing Rules </li></ul><ul><li>Creating Rules </li></ul><ul><li>Fitting FxCop into the Life Cycle </li></ul>
  4. 4. Why Code Validation <ul><li>Ensure adherence to standards </li></ul><ul><li>Ensure consistency </li></ul><ul><li>Ensure following “Best Practices” </li></ul><ul><li>Give guidance to new team members </li></ul><ul><li>Automate Code Reviews </li></ul>
  5. 5. Coding Standards <ul><li>There are established standards for Class Library Developers </li></ul><ul><ul><li>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconnetframeworkdesignguidelines.asp </li></ul></ul><ul><li>These guidelines are implemented as pre built rules for FxCop </li></ul><ul><li>You can build rules for your own standards </li></ul>
  6. 6. Using FxCop <ul><li>Start the Utility </li></ul><ul><li>Select Assemblies to validate </li></ul><ul><li>Add custom rules if you have them </li></ul><ul><li>Analyze </li></ul><ul><li>Review the results </li></ul><ul><li>Exclude Rules as Appropriate </li></ul><ul><li>Make Code Changes as Appropriate </li></ul><ul><li>Save the FxCop Project </li></ul>
  7. 7. Interpreting the Results <ul><li>Add the “New” Column to track whether an issue is new or not </li></ul><ul><li>Navigate through the “Targets” to find only the violations by type, method, property, etc </li></ul><ul><li>Navigate through the “Rules” to find only the violations for that rule </li></ul><ul><li>“ Jump to Source” to have FxCop try to find the source code </li></ul>
  8. 8. The Standard Rules <ul><li>Design Rules </li></ul><ul><li>Globalization Rules </li></ul><ul><li>Interoperability Rules </li></ul><ul><li>Mobility Rules </li></ul><ul><li>Naming Rules </li></ul><ul><li>Performance Rules </li></ul><ul><li>Portability Rules </li></ul><ul><li>Security Rules </li></ul><ul><li>Usage Rules </li></ul>
  9. 9. Creating Your Own Rules <ul><li>Introspection SDK is not documented! </li></ul><ul><li>Use Reflector to review existing rules </li></ul><ul><li>Find an existing rule that does something similar </li></ul><ul><li>Start with the existing rule and understand how it works </li></ul><ul><li>Mold it to your needs </li></ul>
  10. 10. Fitting FxCop Into Your Life Cycle <ul><li>FxCopCmd is command line utility </li></ul><ul><li>Add FxCopCmd as an External Tool </li></ul><ul><li>Output is sent to the “Output” window </li></ul><ul><li>Run FxCop without leaving the IDE </li></ul><ul><li>Review the output with each build </li></ul>
  11. 11. Adding FxCop as an External Tool
  12. 12. Using FxCop Reports <ul><li>Specify a Style Sheet for the Report </li></ul><ul><li>“ Save Report As” from the File Menu </li></ul><ul><li>View the resulting XML file. May need to save it as “HTML” </li></ul><ul><li>Write your own XSLT to change the format </li></ul><ul><li>Include the report with migration requests </li></ul><ul><li>Include the report with Code Reviews </li></ul><ul><li>Include the report with project documentation </li></ul>
  13. 13. Summary <ul><li>FxCop is used to automate the code review process </li></ul><ul><li>FxCop includes rules for detecting over 200 different defects </li></ul><ul><li>You can create your own rules to validate your own standards </li></ul><ul><li>FxCop easily fits into your development life cycle </li></ul>
  14. 14. Where to Get More Information <ul><li>http://aspnet.4guysfromrolla.com/articles/060204-1.aspx </li></ul><ul><li>http://www.futureware.biz/blog/index.php?title=writing_your_own_fxcop_rules_library </li></ul><ul><li>http://msdn.microsoft.com/msdnmag/issues/04/09/Bugslayer/ </li></ul><ul><li>http://www.biasecurities.com/blogs/jim/archive/2004/12/29/818.aspx </li></ul><ul><li>http://www.gotdotnet.com/team/fxcop/ </li></ul><ul><li>http://blogs.msdn.com/fxcop/archive/2004/01/09/49287.aspx </li></ul><ul><li>http://www.gotdotnet.com/team/fxcop/docs/UsingFxCop.htm </li></ul><ul><li>http://www.geekswithblogs.net/nharrison </li></ul><ul><li>http://www.aisto.com/roeder/dotnet/ Reflector! </li></ul>
  1. Gostou de algum slide específico?

    Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

×