locked
Is there any simpler way of customizing FxCop RRS feed

  • Question

  • Hi,

    i am writing my own rules for FxCop. I thought it would be easier if FxCop generates any XML since i could traverse through the nodes of the xml and write my rule easily. But i came to know from David, Mike and Poguru that FxCop does not create any such XML. Is there any simpler or easier way to write my custom rules? or is there any other way through which i can understand and write my own easily?

    Thanks

    Thursday, June 1, 2006 7:13 AM

Answers

  • Guns,

    What kind of rule are you trying to write? Traversing the XML node structure is not the right way to go about this.

    There are numerous FxCop samples available on the web (see the FAQ post at the top of this forum), I've also just uploaded one today: http://blogs.msdn.com/fxcop/archive/2006/05/31/612658.aspx.

    Regards

    David

    Thursday, June 1, 2006 7:28 AM
    Moderator

All replies

  • Guns,

    What kind of rule are you trying to write? Traversing the XML node structure is not the right way to go about this.

    There are numerous FxCop samples available on the web (see the FAQ post at the top of this forum), I've also just uploaded one today: http://blogs.msdn.com/fxcop/archive/2006/05/31/612658.aspx.

    Regards

    David

    Thursday, June 1, 2006 7:28 AM
    Moderator
  • David,

    Thanks a lot.

    I am writing rules that are specific to my company. Since i am using version 1.1 of VS.Net, I am unable to open many sample files.  One such example of custom rule is     

     

    "Are object instantiations, db operations, file operations and other critical operations, covered under exception handler block?"

    Since this is my first rule i need some reference materials for writing rule.

    Thanks

    Thursday, June 1, 2006 8:42 AM
  • Writing analysis checks is difficult, unfortunately. Your best bet is to understand Reflection and IL. After gaining knowledge in these areas, it is much more straightforward to write checks in FxCop (as our data structures and helpers match the concepts here).

    Custom analysis is currently an unsupported scenario, though as David points out there is a reasonable amount of sample code, blogging, and forum support for it.

    Thursday, June 1, 2006 1:45 PM