Optimize your code reviews with Danger

Eduardo Sanches Bocato
1 min readApr 18, 2020

Save time automating part of your code reviews

What is Danger?

Danger is an automation tool, that runs on your CI and checks for pre-defined code conventions, like: linting, formatting, and so on.

Disclaimer

This article does not intend to teach you how to integrate Danger in your CI, but rather present some possible uses and pre-defined snippets for Danger Ruby.

For more informations about its configuration process, reffer to the Getting Set Up guide, from Danger's documentation.

Possible uses

It can be very useful to automate validations like:

  • Code formatting and Linting
  • Warning for changes on a specific file
  • Checking for the presence of Unit Tests
  • Validation PR’s length
  • Check for the presence of some anti-patterns

And so on.

PreBuild Rules

Here I will present some of the rules currently used on the pre-build phase of my CI's Danger setup, most of them gathered from internet searches.

Note: Some of those rules require a Danger plugin, and to add them, you will need to declare those dependencies on your environment’s Gemfile.

--

--

Eduardo Sanches Bocato

iOS Engineer, AI enthusiast, Crossfit/Gymnastics. Currently working as iOS Lead @adidas