Slide 1

Slide 1 text

Danger: smarter, faster and more efficient code reviews Camila Maia

Slide 2

Slide 2 text

Who am I? ● Backend Engineer in the Mobile Squad

Slide 3

Slide 3 text

Code Reviews

Slide 4

Slide 4 text

Code Reviews: They take time!

Slide 5

Slide 5 text

How can we make code reviews smarter, faster and more efficient?

Slide 6

Slide 6 text

Automation

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

● An automated reviewer of your code ● Ruby gem ● Runs after your CI automating your team's conventions surrounding code review What?

Slide 10

Slide 10 text

CI Systems Peer Review Tools Source Control Management (SCM)

Slide 11

Slide 11 text

It is as generic as you want Like Unit Tests, but for your Team Culture. Formalize your Pull Request etiquette.

Slide 12

Slide 12 text

Why? ● More precision on PRs ● Take less time on code reviews

Slide 13

Slide 13 text

With Danger, you can leave humans to think about harder problems.

Slide 14

Slide 14 text

How does it work?

Slide 15

Slide 15 text

Domain Specific Languages (DSL’s)

Slide 16

Slide 16 text

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet if github.pr_title.downcase.include? "[wip]" warn("PR is classed as Work in Progress") end # Warn when there is a big PR warn("Big PR") if git.lines_of_code > 500 # Warn if there's no description warn("Please, provide a description to your PR") if github.pr_body.empty?

Slide 17

Slide 17 text

IMPORT FROM A LOCAL FILE REFERENCE danger.import_plugin("danger/plugins/watch_plugin.rb") RETURNS THE NAME OF THE CURRENT SCM PROVIDER BEING USED. danger.scm_provider

Slide 18

Slide 18 text

Plugins

Slide 19

Slide 19 text

How to integrate it?

Slide 20

Slide 20 text

1 INCLUDE DANGER 2 CREATE DANGERFILE 3 CREATE AN ACCOUNT FOR DANGER 4 CREATE AN ACCESS TOKEN FOR DANGER 5 SETTING UP DANGER TO RUN ON YOUR CI Setup

Slide 21

Slide 21 text

Include Danger

Slide 22

Slide 22 text

Create a Dangerfile DON'T ALLOW A FILE TO BE DELETED deleted = git.deleted_files.include? "my/favourite.file" fail "Don't delete my precious" if deleted

Slide 23

Slide 23 text

Create an Account and an Access Token for Danger

Slide 24

Slide 24 text

Setting up Danger to Run on your Ci

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

Our Experience ● Gradual integration works better ● The culture is the most important part ● It takes time to coworkers get engaged

Slide 27

Slide 27 text

Our Experience ● Pair programming ● Check other projects ● It is awesome for open source projects ● Inheritance might be not that easy

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Community

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

What is next?

Slide 34

Slide 34 text

What? ● Hosted Danger ● Typescript ● Danger JS ● It is a really recent project

Slide 35

Slide 35 text

Why? ● More flexibility: ○ Scheduler, for example ● Settings are more powerful ○ Composition besides inheritance

Slide 36

Slide 36 text

Why? ● Easier to test ● Installation can literally be a single click on the website ● It is a GitHub App (not an account) ○ no need to consider scope for tokens ○ no need to ensure bot has access to repo

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

Stop saying "you forgot to …" in code review

Slide 39

Slide 39 text

THANK YOU FOR YOUR TIME

Slide 40

Slide 40 text

@_camila_maia_ camilamaia https://loadsmart.com/careers/ WE ARE HIRING!