Enhance Developer Productivity With CodeLens Code Health Indicator

CodeHealth

The CodeLens Code Health extension shows the current value of the Maintainability Index for our code and provides us insight into code quality.

Once we have this extension installed, all the methods in our code base displays the maintainability index at the top of it (beside the codelens indicators).

GREEN – Index between 60-100 – Maintainable Method

YELLOW – Index between 40-59 – Moderately Maintainable Method

RED – Index between 0-39 – Difficult to Maintain Method

I have taken screenshots of 3 methods in my project having varied maintainability index, 

2016-01-19_21-28-04

2016-01-19_21-24-54

2016-01-19_21-23-39

As we modify the code, this extension automatically updates the metrics – and shows the impact on the maintainability index, due to the changes.

In other words, we see the results on the fly.

To demonstrate this, I made some changes to the Execute() method below, and it increased the maintainability index by 4. So whenever we modify our code, the maintainability index changes on the fly and gives us immediate feedback.

 DiffTrend 

I talked about Code Metrics and SonarQube in my blogs, which also shows us similar information regarding code quality.

SonarQube and Code Metrics are powerful tools which displays the code quality statistics for the entire project in one place. The Code Health Indicator extension just shows a subset of that data, but on a method level, so that developers gets the feedback of the changes they are making instantly.

To summarize, there are 2 reasons why I particularly love this VS extension,
  • I get the results in real time.
  • I do not need to run Code Metrics separately.

Try out this cool extension today. As a developer, this is a pretty nice tool to have in your arsenal.

Here is the link to download Microsoft CodeLens Code Health Indicator.


Similar Articles