Announcing Code Health Metrics for CodeLens – A DevLabs Project
One year ago I moved from Boise, Idaho, to Redmond, Washington, to work for Microsoft. At the time of our move, I owned a stretch-cab 1995 Ford F-250 four-wheel-drive pickup. That wasn’t going to work in the traffic of suburban Seattle, and I don’t foresee pulling a horse trailer here (or my buddy out of a mud hole), so I got a Scion IQ and sold the truck.
Becoming a Cleaner Driver
I drove the Scion for a few weeks before noticing an occasionally lit green light on the dash board. At first, I merely noted the light. It didn’t bother me, but I had more things on my mind at the time, being new to the rush hour. I noted the light a few weeks later and looked closer to see it was an "eco" indicator. With some time on my hands sitting in the middle of the 520 freeway, I dug out the owner’s manual (I know, I know. I shouldn’t have done that while driving).
It turns out the eco indicator comes on when I am getting the most fuel efficient performance out of my car. Here is how Scott Mancuso described his relationship with his eco light in his Open Letter to My Car’s Eco Light.
"It only comes on when I?m driving like an environmental warrior. Sometimes people would ask, isn?t that really distracting? I would say, oh no, not at all. Actually, it?s really fulfilling, and it?s saving the environment, and it?s like a game and it?s not distracting at all because really all I want to do is satisfy the ECO light. I just want to keep it happy and on my dashboard where it can silently warm my field of vision with its comforting green glow. It?s like a game. I am at ease. I am helping."
This was exactly my experience. So, we built an eco-light for your code.
Becoming a Cleaner Developer
While our teams were creating the CodeLens feature this summer, we had some interns in from universities around the world working on projects. One intern spent her summer building a CodeLens indicator to show the measures used in calculating the Maintainability Index for software.
The very experimental Code Health Indicator for CodeLens looks like this.
It can tell you when you’ve made the method better.
Or, maybe you made it worse.
And details are provided at various levels of maintainability.
And even more detailed information is available in the tooltips.
Come and Get It
Today, we released that Indicator on DevLabs, an experimental delivery channel for Visual Studio add-ins, and you can install it on your Visual Studio 2013 Ultimate RC build. I think I am one of the few people interested in this indicator, so I just took control of the code and am releasing it via an experimental deployment channel so I can learn what you want the indicator to do before investing more time.
I really love this idea and hope this finds a nice home in your code quality toolkit. Some disclaimers before I point you to a link.
- This is an experimental add-in for VS. It will not have the same level of testing and rigorous inspection as in-product software.
- Only works on C# and VB.
- Only shows up on methods.
- UX needs work and we know that.
Send your suggestions via the smiley face in Visual Studio, right here on this blog post, or via the Visual Studio User Voice page.