Another look on tech

My thoughts on tech.

When Cake meets NDepend

31 December 2017

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

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

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

An example

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.