Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

When Cake Meets NDepend

DZone's Guide to

When Cake Meets NDepend

We take a look at using the Cake build automation system along with the static code analysis tool NDepend to help in conducting code reviews and other tasks.

· Integration Zone ·
Free Resource

How to Transform Your Business in the Digital Age: Learn how organizations are re-architecting their integration strategy with data-driven app integration for true digital transformation.

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 and 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 with 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 the 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 downloading and uncompressing the reports artifacts, it is something similar to this:

Screen Shot 2017-12-31 at 17.45.02

The Holy Grail

The Holy Grail 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 in maintaining quality standards, rather than reactive.

Make your mark on the industry’s leading annual report. Fill out the State of API Integration 2019 Survey and receive $25 to the Cloud Elements store.

Topics:
ci ,cake ,ndepend ,integration ,automation

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}