Code Metrics Viewer 2015 is available for download

I am a man of few words… a new extension package is out now that integrates the Code Metrics Power Tool for Visual Studio 2015 into Visual Studio 2015 (requires Update 1). It provides the exact same functionality as it´s predecessor targeting Visual Studio 2013, except to a minor fix required to make themes work properly, since the way the IDE stores information about the currently selected theme had slightly changed…

Advertisements

Updated: Roslyn Metrics extension

Roslyn seemed to be a good choice…

The Roslyn compiler API has evolved over time… the latest pre-release available on Nuget performs way better than the CTP published almost two years ago, so I decided to continue working on my metrics calculator that is based on Microsoft´s new compiler API. In addition to the initially implemented metrics, like maintainability index, cyclomatic complexity, depth of inheritance, class coupling and lines of code, I added a bunch of other metrics. For instance, lack of cohesion of methods (a metric that can be used to find poorly cohesive types), the number of overloads of a method, the number of lines of comments and some other low-hanging fruits likes counters for fields, method parameters, methods, types and so on…

The Roslyn metrics extension does not analyze compiled assemblies, instead syntax- and semantic models are used to aggregate information right from the source code. In my opinion, this has some significant advantages, because calculated metric results are closer to the code typed by the developer (since the code is not optimized by the compiler). It´s also possible to calculate metric results even on projects which do not compile (for instance, due to missing third-party assemblies or any other kind of build dependency).

Calculating metrics on non-optimized (as typed) code also allows the definition of metrics which put code readability more into focus. For instance, I could imagine a metric that finds all variable declarations in a method, which could be moved closer to their usage, which is something that drastically improves readability and stability, because narrowing the scope of a variable can help to prevent situations where a variable has not been set to a valid instance or value. The purpose of the lines of comments metric (as already implemented) is obvious, I think… comments are adding noise to the code, which has a poor impact on readability (apart from that, comments are usually not more than a pack of lies). Code containing comments might also hold potential for refactoring.

Anything else? Yes. Now, the metrics calculator is also available as a standalone application, so it´s possible to use the tool in a CI build environment. The download can be found at http://bit.ly/roslynmetricsutil

Published: Code Metrics Viewer 2012

I published updates of all my Visual Studio Gallery contributions. Actually, there´s no new functionality in there, just minor changes, a few bug-fixes and updated references to third-party libraries. I changed the names of the tools a bit; “Code Metrics Viewer” has been renamed to “Code Metrics Viewer 2010” and the pre-release of “Code Metrics Viewer 2” is now named “Roslyn Metrics“, which makes more sense since I created the Code Metrics Viewer 2012 extension that integrates the Code Metrics Power Tool 11.0 into Visual Studio 2012.

As I wrote in my last post, the Code Metrics Power Tool 11.0 does not have a setup… but don´t worry (-: After you´ve installed the Code Metrics Viewer 2012 extension, just open the Options dialog, navigate to Code Metrics, then Tools – and click the “Download and Install…”-button. This will download the Power Tool from http://bit.ly/11b4mqX and extract it to the local FxCop-directory. If you´re interested in how the setup routine works, you can take a look at the code that I published on Github…

Code Metrics Viewer 2012 Options Dialog

New release: Version 1.6.0

I migrated the WPF user interface (that I had implemented for Code Metrics Viewer 2) to the Visual Studio 2010 extension in order to address some user interface issues which have been requested by users many times. Now, the grid allows to scroll horizontally, allows to change the position of grid columns and icons have been added to namespace-, type- and member- nodes. I also removed the modal progress dialog – and added an indeterminate progress indicator to the tool window instead. The toolbar is now a native Visual Studio toolbar that uses the blue theme…

code-metrics-viewer-window-2