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.
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?
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. :)
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?
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:
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.