{"id":5,"date":"2015-08-10T19:12:00","date_gmt":"2015-08-10T19:12:00","guid":{"rendered":""},"modified":"2016-01-30T22:30:01","modified_gmt":"2016-01-30T22:30:01","slug":"easy-way-to-suppress-code-analysis-warnings","status":"publish","type":"post","link":"https:\/\/tpodolak.com\/blog\/2015\/08\/10\/easy-way-to-suppress-code-analysis-warnings\/","title":{"rendered":"Easy way to suppress code analysis warnings"},"content":{"rendered":"<p>Everyone who has ever been using a code analysis knows that sometimes it is hard to follow the <i>Microsoft<\/i> coding guidelines and it is necessary to suppress some warnings. For me it always was a painful operation because I didn&#8217;t know any automated way of doing that. So basically I had to find the warning in the <i>MSDN<\/i>, copy category, code and other necessary stuff and then manually add appropriate attribute in code. Fortunately a friend of mine yesterday showed me a simple trick to generate this attribute with couple of mouse clicks. All you have to do is to right-click on warning message and choose <i>Suppress Message<\/i> context menu &#8230;<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2015\/08\/easy-way-to-suppress-code-analysis-warnings\/ContextMenu.png\" rel=\"attachment wp-att-252\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2015\/08\/easy-way-to-suppress-code-analysis-warnings\/ContextMenu.png\" alt=\"code analysis\" width=\"600\" class=\"aligncenter size-full wp-image-252\" \/><\/a><\/p>\n<p>There are two options in there. The first option &#8211; <i>In Source<\/i>, will add attribute directly in the code <\/p>\n<p><a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2015\/08\/easy-way-to-suppress-code-analysis-warnings\/SuppressInSource.gif\" rel=\"attachment wp-att-255\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2015\/08\/easy-way-to-suppress-code-analysis-warnings\/SuppressInSource.gif\" alt=\"code analysis\" width=\"600\" class=\"aligncenter size-full wp-image-255\" \/><\/a><br \/>\nand the second one &#8211; <i>In Suppression<\/i> File, will create <i>GlobalSuppressoins.cs<\/i> file with assembly attribute which suppresses given warning in entire assembly  <\/p>\n<p><a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2015\/08\/easy-way-to-suppress-code-analysis-warnings\/SuppresionGlobal.gif\" rel=\"attachment wp-att-254\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2015\/08\/easy-way-to-suppress-code-analysis-warnings\/SuppresionGlobal.gif\" alt=\"code analysis\" width=\"600\" class=\"aligncenter size-full wp-image-254\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Everyone who has ever been using a code analysis knows that sometimes it is hard to follow the Microsoft coding guidelines and it is necessary to suppress some warnings. For me it always was a painful operation because I didn&#8217;t know any automated way of doing that. So basically I had to find the warning [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3,4],"tags":[160,159,161],"class_list":["post-5","post","type-post","status-publish","format-standard","hentry","category-net","category-c","category-code-analysis","tag-net","tag-c","tag-code-analysis"],"_links":{"self":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":4,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":521,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/5\/revisions\/521"}],"wp:attachment":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}