Last post Jan 04, 2013 08:38 AM by m.koopman
Jan 02, 2013 12:33 AM|spdev101|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 09:16 AM|m.koopman|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 02, 2013 11:43 PM|spdev101|LINK
Jan 04, 2013 08:38 AM|m.koopman|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.