When Cake meets NDepend

As a developer, I’m a big fan of automation. I can’t create software where I need to push buttons and run manual scripts, to test & deploy it. To help me automate my software development tasks, I use Cake, “a cross platform build automation system with a C# DSL”.

Working as a team, there are specific tasks to be carried, such as code reviews. A code review can be focused on architectural principles, naming conventions, test coverage, among others. To aid the code reviews, static code analyzers can be used, helping with the code analysis. Personally, I prefer NDepend, because of the wide range of reports and insights about the codebase.

Joining the best of both worlds

After a bit of research, I couldn’t find a Cake Addin that interfaces NDepend. Given Cake is Open Source Software, why not create one?

This-is-open-source

From this thought was created the Cake NDepend Addin. It is a regular Cake Addin based on NDepend Console. Although NDepend offers integration with the major CI servers, the usage of Cake allows a layer of abstraction, avoiding the “works on my machine” principle. 🙂

A live example

Eat your own dog food. That’s it, the Cake NDepend Addin uses itself to create a build artifact in each commit to GitHub. Inception?

inception

I want to report on every commit to my git repo. AppVeyor is instrumented to configure NDepend (the way to configure external software on each CI server is different) and uses the Cake NDepend Addin through the Cake script, producing the reports as artifacts. You can inspect an example here.

After download and uncompress the reports artifacts, it is something similar to this:

Screen Shot 2017-12-31 at 17.45.02

The Holy Graal

The Holy Graal would be the integration of the report’s metrics with a Pull Request. It would give visibility to the reviewers about the code quality trends, enabling the developers to be proactive to maintain the quality standards, rather than reactive.

One thought on “When Cake meets NDepend

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 )

Google+ photo

You are commenting using your Google+ 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