Home > CruiseControl.Net > NDepend and CruiseControl.NET

NDepend and CruiseControl.NET

Some History

A while back Patrick Smacchia from NDepend did an analysis of the code in CruiseControl.NET (read it here). I sent him an e-mail thanking him, and one thing lead to another, and before you know it I had volunteered myself to help integrate NDepend better with CruiseControl.NET.

You Did What? Why?

Now you’re probably wondering why I volunteered my time (yes, I don’t get paid to work on CruiseControl.NET). There’s a very simple reason behind it – I think NDepend is a awesome tool for getting information on what’s happening in your project.

Anyone who has worked in software development for a while knows about spaghetti code. This is code that has become some convoluted and twisted that it is a nightmare to maintain! Now, as a developer, I know we all code with the best of intentions, but sometimes code just seems to get “spaghetti”ed, and it’s even worse when we start talking about open source projects.

NDepend helps open a picture on what is happening in the codebase. It shows many different aspects where code can become twisted (I’m still learning about them) and Patrick has written several blog posts about how to use this information to clean up the code. Additionally, it can also provide an historical analysis. So not only can you see what your code is like, you can also see how well you are doing in making it better!

As you might have guessed, I’m very impressed with NDepend and the details it provides. If you are interested in finding out more, take a look at their website: http://www.ndepend.com/.

Better Integration

While it has always been possible to integrate NDepend into CruiseControl.NET it was a bit of a convoluted process. First, you needed to call NDepend from either Nant or MSBuild. Then you needed to merge the results from NDepend. And finally the dashboard needed to be set up. And to top it all off, it wasn’t possible to view the images from NDepend!

What I have done is added a new NDepend task. This will run the NDepend application (same as the Nant or MSBuild tasks), but directly from a ccnet.config. The added value comes after the execution – the new task will automatically publish the NDepend results, and merge the XML files. This means NDepend now only needs the single task within ccnet.config – instead of modifying the build script and then adding a merge publisher into ccnet.config.

I’ve also put together a package for the dashboard. This simplifies the administrator’s work in adding the results to the dashboard. All the administrator needs to do is go to the admin plug-in and load and install the package. No more messing about with copying files, changing configuration settings and restarting IIS!

Displaying Images

As well as the NDepend-specific work, I’ve also fixed a more generic issue – displaying images in the dashboard.

First, a bit of background. CruiseControl.NET is divided into two parts – the CI server and the web dashboard. These can run on the same machine, or totally different machines, so we can’t assume that the dashboard can access any files that the CI server can. Therefore some way is needed to transfer files from one application to another.

To keep things simple, I added a new file transfer mechanism to the CI server. This means a remote client can now request files from the CI Server and they will be transferred using .NET Remoting (not the best way, but .NET Remoting is the only transport channel that the server currently has.) So now there is a way to transfer files, even if they are on different machines.

The second part is to add a new action to the dashboard that uses this file transfer. This is a simple project-based action that takes in a query string parameter saying which file to be transferred. When the action is processed, the file is fetched from the CI server and downloaded to the browser (all via streams, so nothing is stored locally).

To display the images, all I needed to do was to modify the XSL-T template to use the new action (it’s called RetrieveFile.aspx) and pass in the name of the file to display. Now the NDepend reports display all the text data and the images as well!

Tell Me More

The good news is this task made the cut for 1.4.4. So when 1.4.4 is released, the new task, package and image work will be available!

Full details on the new task are available at http://confluence.public.thoughtworks.org/display/CCNET/NDepend+Task. There are some instructions on how to integrate NDepend at http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+NDepend – this covers both the new and the old ways of integration.

Finally, I’m going to write a full tutorial on how to use NDepend and CruiseControl.NET together sometime. This will include a walk-through on how to do this, plus a full example.

And, as a final note, we’re looking to start using NDepend with CruiseControl.NET to tidy up our own code. As I play around with it and figure out things I’ll include them in my blog. (But I’m still catching up on things, so these blog posts might be take a while!)

About these ads
Categories: CruiseControl.Net Tags:
  1. grenzi_r
    9 February, 2011 at 8:40 pm | #1

    Hi there,

    I don´t know who to contact but I want to tell you that the WebSide according to google malware hosts: http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=http://confluence.public.thoughtworks.org/display/CCNET/News&client=googlechrome&hl=de

    • Craig Sutherland
      9 February, 2011 at 8:43 pm | #2

      Thanks for letting us know,

      Unfortunately it appears that the organisation that is hosting our site (ThoughtWorks) has been infected with malware somehow. They are trying to resolve it but are unable to give us a timeframe on when.

      Craig

  2. Ricky
    11 May, 2010 at 9:09 am | #3

    hi! i just want a link or a doc which explains completely, how to configure Ndepend with CC.Net. Please it’s an emergency.
    Thanks

  3. Alejandra
    6 May, 2009 at 8:29 am | #4

    Hello,

    I want to quit the Ndepend report from the Build Report, but still have the link ‘NDepend Report” in link in the left navigation. How can I do that?

    thanks!

    Alejandra

    • Craig Sutherland
      30 May, 2009 at 12:45 pm | #5

      Hi Alejanda,

      This is easy to do, open dashboad.config, find the <buildReportBuildPlugin> section and remove the ndepend report from there. This will require resetting the web server after the file has been modified.

      Craig

  1. 29 April, 2009 at 10:40 pm | #1

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: