CodeLens Indicator for Code Health

Mathew Aniyan MSFT

Yesterday, we released the Visual Studio 2015 version of the CodeLens Indicator for Code Health in Visual Studio Gallery.  This extension is an update to the Visual Studio 2013 version, which we had released in Sep 2013 as a Microsoft DevLabs extension.

 

This CodeLens Indicator gives the current value of the Maintainability Index for the code element to which it is attached.

 image

 

If you are interested in reading more about the Maintainability Index, here is the MSDN article on Code metrics, Wikipedia page  and a blog on the topic. Halstead Volume is described here.

 

Once you start editing a file, the metric is re-calculated dynamically.  It will also show an indicator (to its left) showing the trend in value. i.e Is the value improving or deteriorating? In the detail window, you can also see how each component value has been affected by the recent edits. The change is calculated since the beginning of the current Visual Studio session.

 

NOTE that the functionality of this indicator is unchanged from the VS 2013 version. Since this extension uses Roslyn, which has evolved significantly since 2013, we had to make some changes to ensure that the extension worked with VS 2015.

 

You can also see the Code Metrics information in Visual Studio using the Analyze menu as described in How to: Generate Code Metrics Data.  Recently, we announced the integration of MSBuild and TFS with SonarQube. SonarQube also calculates similar code metrics. Unfortunately, the metrics shown in the three tools (VS Code Metrics window, SonarQube and this CodeLens indicator) do not match always. We have a backlog item to reconcile them and come up with a unified view.

 

Please try out this plugin and give feedback using Q&A or review tabs in VS Gallery. You can also post suggestions at http://visualstudio.uservoice.com .

 

Here is the download link – https://visualstudiogallery.msdn.microsoft.com/54b2682c-47f4-48ee-9d6d-190402330c49

0 comments

Discussion is closed.

Feedback usabilla icon