{"id":5263,"date":"2012-03-21T07:42:50","date_gmt":"2012-03-21T07:42:50","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2012\/03\/21\/the-code-index-part-3-code-samples-for-using-indexed-information\/"},"modified":"2019-02-14T17:59:32","modified_gmt":"2019-02-15T01:59:32","slug":"the-code-index-part-3-code-samples-for-using-indexed-information","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/the-code-index-part-3-code-samples-for-using-indexed-information\/","title":{"rendered":"The Code Index \u2013 Part 3 \u2013 Code samples for using indexed information"},"content":{"rendered":"<p>We have published two samples, on the Code Gallery showing how to get data from the code index.<\/p>\n<p>The first sample, <a href=\"http:\/\/code.msdn.microsoft.com\/Code-Index-statistics-19030285\">Code Index &#8211; How to get statistics about your code<\/a>, shows how to retrieve some statistical information from the <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2012\/03\/13\/the-code-index-sdk.aspx\">code index<\/a>, and in particular:<\/p>\n<ul>\n<li>The number of indexed assemblies<\/li>\n<li>The namespaces defined in indexed assemblies<\/li>\n<li>The number of types defined in the indexed assemblies, detailing the number of classes, interfaces, enumerations, structures, delegates (total, and public API only)<\/li>\n<li>The number of indexed methods, fields, properties, events<\/li>\n<li>The class having the most members<\/li>\n<li>The number of assemblies which are referenced but not indexed<\/li>\n<li>The test assemblies (the assemblies which defined test methods, using the MSTest attributes)<\/li>\n<li>The assembly referencing the most assemblies<\/li>\n<li>The assembly which is the most referenced (globally &ndash; this is probably mscorlib J, or among the indexed assemblies)<\/li>\n<li>The number of inheritance relationships (excluding the inheritance from System.Object, which is not very interesting)<\/li>\n<li>The most derived type<\/li>\n<li>The most implemented interface<\/li>\n<li>The number of method calls<\/li>\n<li>The method calling the most methods<\/li>\n<li>The method being called the most<\/li>\n<li>&hellip;<\/li>\n<\/ul>\n<p>Looking at the sample&rsquo;s source code you will learn a lot on how to query the code index to answer your own questions.<\/p>\n<p>&nbsp;<\/p>\n<p>The second example is <a href=\"http:\/\/code.msdn.microsoft.com\/Code-Index-How-to-discover-e2d54475\">Code Index &#8211; How to discover ignored tests<\/a>. It shows how to write an useful tool (effectively used in my team) : you probably know that when using MSTest to build your suite of unit tests, you can add an attribute [Ignore] to tell the MSTest engine not to run a test (instead of commenting the test method). You may also use the attribute [WorkItem(id)] to link the unit test to a bug database (such as TFS) item, so that you can trace why a particular test has been marked as ignored. It is considered good practice to open a bug when you decide to ignore a test and to link the test to this bug. This way, after fixing the bug, the developer will remember to re-enable the test. This samples shows how to discover the ignored tests, and the ignored tests without work items. It produces an HTML report if the ignored tests<\/p>\n<p>&nbsp;<\/p>\n<p>I&rsquo;ll let you discover the samples, play with them, modify them. In my next posts, I&rsquo;ll provide a bit more details about the query API.<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have published two samples, on the Code Gallery showing how to get data from the code index. The first sample, Code Index &#8211; How to get statistics about your code, shows how to retrieve some statistical information from the code index, and in particular: The number of indexed assemblies The namespaces defined in indexed [&hellip;]<\/p>\n","protected":false},"author":77,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[226,1],"tags":[],"class_list":["post-5263","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ci","category-devops"],"acf":[],"blog_post_summary":"<p>We have published two samples, on the Code Gallery showing how to get data from the code index. The first sample, Code Index &#8211; How to get statistics about your code, shows how to retrieve some statistical information from the code index, and in particular: The number of indexed assemblies The namespaces defined in indexed [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/5263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=5263"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/5263\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=5263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=5263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=5263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}