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?
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:
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.
Matthijs Koopman
Please mark my reply as answer if you found it help full
spdev101
0 Points
23 Posts
Suppression files global vs local
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?
m.koopman
Participant
1372 Points
294 Posts
Re: Suppression files global vs local
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:
http://entityframework.codeplex.com/SourceControl/changeset/view/883672ac8479#src/EntityFramework/DbContext.cs
So I would say use inline supression.
Please mark my reply as answer if you found it help full
spdev101
0 Points
23 Posts
Re: Suppression files global vs local
Jan 03, 2013 03:43 AM|LINK
m.koopman
Participant
1372 Points
294 Posts
Re: Suppression files global vs local
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.
Please mark my reply as answer if you found it help full