Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 04, 2013 12:38 PM by m.koopman
Jan 02, 2013 04:33 AM|LINK
We are currently using the Microsoft rule sets and stylecop to validte our code. When it comes to supression of certain rules, what is the best way, is it using a global suppression file or suppressing inline in the code itself?
Jan 02, 2013 01:16 PM|LINK
If you use one global supression file things might get messy over time, when you take a look at the source code of Entity Framework you will see Microsoft uses inline supression:
So I would say use inline supression.
Jan 03, 2013 03:43 AM|LINK
Jan 04, 2013 12:38 PM|LINK
I can see your concern, will you be shipping the code as-is or will you be shipping a compiled DLL or something like that. According to your post i suppose you will be shipping the code as-is, but just to confirm.
Well as long as you place good reasons for the suppression along with the suppression attribute to developers using your code base can first of all see you paid attention to your code by running code analysis. Furthermore they can read why you decided to
supress the warning and can or cannot aggree with your argumentation. If they won't agree they might come up with a better solution to get rid of the original warning.
But if you really do not want the end developers to see the suppression rules you might wanna go with the global suprression and exclude the file when shipping.
But as you might have seen in the Entity Framework source code, Microsoft does not seem to see the local suppression as a problem. Maybe you might wanna look deeper into how Microsoft did setup the opensource project for Entity Framework.
Hope it helps.