blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

Howard van Rooijen's Blog

MonkeyWrangler - Making Simian more usable in Visual Studio

In my last post I talked about integrating Simian into Visual Studio - as Mal commented the default output from Simian is not very Visual Studio friendly:

Found 6 duplicate lines in the following files:
 Between lines 163 and 171 in D:\Projects\Conchango\Conchango.Gluon\Conchango.Gluon.Plugins.Interface\ConfigSettings.cs
 Between lines 141 and 150 in D:\Projects\Conchango\Conchango.Gluon\Conchango.Gluon.Plugins.Interface\ConfigSettings.cs

It is not in the standard output format that Visual Studio understands thus you cannot double click on a line of duplicated code in the output window and navigate directly to that code file and line of code. So on a very long train journey home from work this week I wrote MonkeyWrangler - a shim tool that executes Simian and reformats the output into format that Visual Studio understands:

Found 9 duplicate lines in the following files:
 
D:\Projects\Conchango\Conchango.Gluon\Conchango.Gluon.Plugins.Interface\ConfigSettings.cs (163) 171
 D:\Projects\Conchango\Conchango.Gluon\Conchango.Gluon.Plugins.Interface\ConfigSettings.cs (141) 150

Now you can double click on the line and you will navigated to that file / line of code.

To set up MonkeyWrangler - simply build the project, and then in the External Tools menu in Visual Studio (see my last post for full instructions) replace the command line option for "simian-2.2.8.exe" with the path to "Conchango.Code.Build.MonkeyWrangler.exe" then all you need to do is update the location of "simian-2.2.8.exe" in "Conchango.Code.Build.MonkeyWrangler.exe.config".

Thanks to Stuart Preston for the RegExp help.

You can download the tool from my Project Distributor workspace.

Published 18 February 2006 14:11 by howard.vanrooijen
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Mal Ross said:

Nice one! Thanks for this, Howard. I made my own little pass-through console app to tide me over, but this sounds much better. Now I just need an app to automatically graph the results over time... ;)
February 28, 2006 10:20
 

Jay Flowers said:

Very cool. There was a problem with large output and it only passed one commandline var to simian. Here is a patch:

public void Wrangle()
{
using (Process proc = new Process())
{
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.FileName = this.simianExe;

string CommandLine = System.Environment.CommandLine.Replace(this.GetType().Assembly.Location, "");
CommandLine = CommandLine.TrimStart('"');
CommandLine = CommandLine.TrimStart(' ');

proc.StartInfo.Arguments = CommandLine;

proc.Start();
StringBuilder OutPutBuilder = new StringBuilder();
while (!proc.HasExited)
{
if (!proc.Responding)
proc.Kill();
OutPutBuilder.Append(proc.StandardOutput.ReadToEnd());
}

Console.Write(this.ParseAndReformatOutput(OutPutBuilder.ToString()));

proc.Close();
}
}
March 15, 2006 14:56
 

Eric M said:

Howard-

Cool tool. Two questions (or maybe these are feature requests). First, is there a way to get this to work of your project directories are not subdirectories of your solution folder? Second, web projects fail with an error, since they are accessed via a url (http://localhost/...) instead of through the filesystem. Any ideas how to make this work? I realize this might be more of a Simian question than a MonkeyWrangler issue.

Regards-
Eric
March 15, 2006 16:14
 

howard.vanrooijen said:

Jay,

Excellent work - I'll update the main version with this when I get time - thanks very much for the improvement!
March 16, 2006 08:36
 

howard.vanrooijen said:

Eric,

Yes - this is more of a Simian question - but if you look at my last post about configuring Simian inside your VS IDE - http://blogs.conchango.com/howardvanrooijen/archive/2006/02/08/2776.aspx - you could easily create a new external tool which is configured specifically to point at the file system location of your web site.
March 16, 2006 08:38
 

Chris Burrows .NET Blog said:

A while back I mentioned a Java application that searches for code duplication called Simian.  ...
March 16, 2006 10:01
 

Anthony Steele's Blog said:

Don't repeat yourself. I'll say it again – don't repeat yourself. When writing code,
February 26, 2007 15:04
 

Monkeyget said:

There is an option in Simian to output the data in the Visual Studio format. Simply add the option "-formatter=vs " and you'll be able to click on the outputed data to open the corresponding source file. It has the advantage of being simpler to set up and it streams the result.
June 4, 2007 09:09

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems