Enhance Developer Productivity with CodeLens Code Health Indicator


In this blog, we will look at a very cool Visual Studio 2015 extension called ‘CodeLens Code Health Indicator’ and its features.

This 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 –




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.


I talked about Code Metrics and SonarQube in my previous 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.

If you have not gone through these posts, I would highly recommend you to —


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 –  https://visualstudiogallery.msdn.microsoft.com/54b2682c-47f4-48ee-9d6d-190402330c49


Categories: C#, Performance, Visual Studio

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: