Is it possible to compare metric results?

Yes, it is! The latest version of the extension has basic comparison functionality. I thought this could be very helpful, if one would use the extension during code review and/or refactoring. When I used the tool during re-factoring, I had the problem that it was hard to see, if values were getting better or worser. So, I thought it would be nice to load a previously calculated report and compare the data against the latest results, to be able to show some kind of “trend” within the grid. This is one of the features I wanted to wait with until end of this summer, because there is still some work to do… in other words, by now it´s not perfect :-) In some situation the comparison might not work…

I calculated metrics for a very simple console application… Here you can see the Main()-method of the static Program-class, which has a maintainability index of 57. Of course, this is still okay, but it could be better…

So, I made some refactorings to the Program-class… I created two new methods named ExtractPublicKey() and WriteKeyFile, recompiled the assembly and calculated the metrics again…

Now I can use the compare feature, to see if I made some “good” progress :-) As you can see in the screenshot, there is a new button named “Compare…” in the toolbar. If you press that button, a file dialog will show up, where you can select the candidate report for comparison. If you want to work with the compare feature I recommend to enable the auto-save functionality in the options dialog – so, a new report will be stored in the solution folder, each time you calculate code metrics.

In my example I have choosen the report, which was calculated before I did the refactorings – and I see, that the maintainability index increased by 7.

By the way… if you like the tool, I would be glad if you would rate the tool with five-stars in the Visual Studio Gallery :-)


8 thoughts on “Is it possible to compare metric results?

  1. I’ve generated 2 xml files using the command line tool and wanted to compare them but the tool doesn’t seem to work in this manner… is it supposed to? what alternatives might there be?

    • Of course you can open the file using the viewer (use the open button in the viewer window´s toolbar). Please notice that the default extension filter is set to *.xml and *.mrx; so you might change the filter in the open file dialog in order to see your report file. The extension verifies the report file by using a XML schema; if the selected file does not have the expected XML structure, the tool won´t process it. It works the same for files you select via the compare button. The compare feature can be used to compare reports which have been created from one assembly. Let´s say you calculate the metrics from an assembly, than you make some changes to the assembly and rebuild it and calculate a new metrics report. Than these to reports can be compared in order to see visual improvement indicators… Comparing reports of two different assemblies would probably also work, but wouldn´t make much sense, I guess (-:

  2. ah. my issue then is that in rewriting this project I’ve renamed it so it can run side-by-side with the old project… so I’m really trying to compare two different assemblies, and that doesn’t seem to work. but that fair enough. it would be nice to have but that’s really a different use-case for this tool.

    thanks for writing and maintaining it. it’s an excellent tool.

  3. Hi,
    Thanks for your great post!
    I just have a question about the comparison report. Can I export it to an excel file? My PM does not install Visual Studio in his PC to open the .dmrx file so I need to export this type of report in excel format.

Leave a Reply

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

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s