Use the Code Metrics Results window

The Code Metrics Results window displays the data that is generated by the code metrics analysis. For more information about code metrics data values, see Code metrics values.

Display code metrics results

The Code Metrics Results window is displayed automatically when you generate code metrics results. You can also display the window at any time.

You can display the Code Metrics Results window using one of the following menu sequences:

  • On the Analyze menu, choose Windows > Code Metrics Results.

  • On the View menu, choose Other Windows > Code Metrics Results.

The Code Metrics Results window opens, even if it contains no results.

To view code metrics details

If code metrics results have been generated, expand the tree in the Hierarchy column.

Filter code metrics results

You can filter the results that are displayed in the Code Metrics Results window by using the toolbar at the top. For example, you might want to see only the results that have a maintainability index below 65.

The Filter dropdown list box contains the names of the results columns. When a filter is defined, it is added to the bottom of the list together with an indentation. The list can contain the last 10 filters that were defined.

To filter the code metrics results

  1. From the Filter list, select the column name.

  2. In Min, type the minimum value to be displayed.

  3. In Max, type the maximum value to be displayed.

  4. Click the Apply Filter button.

  5. To see the result details, expand the hierarchy tree.

Add, remove, and rearrange data columns

You can add or remove results columns from the Code Metrics Results window. In addition, you can rearrange results columns so that they appear in the order that you want.

Add or remove a column

  1. Click the Add/Remove Columns button, or right-click any column heading and then click Add/Remove Columns.

  2. In the Add/Remove Columns dialog box, select, or clear the checkbox for the column that you want to add or remove, and then choose OK.

Rearrange columns

  1. Click the Add/Remove Columns button.

  2. In the Add/Remove Columns dialog box, select the column that you want to move and then choose either the up arrow or the down arrow.

  3. When the column is positioned where you want it, choose OK.

Copy data to the clipboard or Excel

You can select and copy a selected row of code metrics data to the clipboard as a text string that contains one line for the name and value of each data column. You can also click Open Selection in Microsoft Excel to export all of the code metrics results to an Excel spreadsheet.

Create a work item based on code metric results

You can create an Azure Boards work item that is based on results in the Code Metric Results window. When the work item is created, Visual Studio automatically enters a title in the Title field and code metrics data under the History tab.

For more information about Azure Boards work items, see Work items.

To create a work item based on a result

  1. Right-click the result.

  2. Point to Create Work Item, and then click the type of work item you want to create (Bug, Task, and so forth).

  3. Complete the work item form by filling in all required fields.

  4. On the File menu, click Save All to save the work item.

To create a bug based on a result

  1. Click the result to select it.

  2. Click the Create Work Item button.

  3. Complete the work item form by filling in all required fields.

  4. On the File menu, click Save All to save the work item.

See also