Code analysis defect counts are available in the cube that is part of the TFS Data Warehouse. This post shows you how to hook up Excel to show code analysis counts in a pivot table.

    First off you need to connect Excel up to the data warehouse that has the data. Under the Data tab in Excel select From Other Sources, From Analysis Services.


    Then you need to give the name of the server with the data warehouse. In the standalone TFS case this will be whatever machine is running TFS. Assuming you have read permissions with your Windows account you can click Next, otherwise enter a user name and password that has access to the server and click Next.


    Then, select the database (usually TfsWarehouse) and select the Build table.


    Click Next and then supply whatever additional information that will help you remember this data connection.


    Click Finish. Then define how you want to show the data in Excel - e.g. a pivot table.


    Click OK which gives you the following:


    In the PivotTable Field List, Expand Build Project where you will find two fields: Static Analysis Errors and Static Analysis Warnings:


    You can click the checkboxes to add these to the values for your table. In most cases Static Analysis Warnings would be the most useful since Static Analysis Errors would typically stop the build.

    To complete the picture you can play with the pivot table and pivot and filter as you see fit. As a simple example you can add the Build field:


    Which will give you one row per build in the pivot table.


    Of course this data can be combined with other build data and charted etc. according to your needs. We are considering what reporting to provide in future versions so would love to hear your feedback on this feature and what you would like to see.