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
CRM integration has become the cornerstone to meeting initiatives across organizations. Explore the top 6 value-driven Salesforce CRM integrations ebook.  

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.

Sync, automate, and notify lead to customer changes across marketing, CRM, and messaging apps in real-time with the Cloud Elements eventing framework. Learn more.

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 }}