Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Danger: code reviews mais automatizados, rápido...

Danger: code reviews mais automatizados, rápidos e inteligentes

O processo de code review tem sido cada vez mais adotado por quem preza pela qualidade do código gerado. Ter o código revisado por outro(a) desenvolvedor(a) antes de submetê-lo permite que, com uma visão menos enviesada e com experiências diferentes, os revisores possam apontar erros e melhorias não levadas em consideração anteriormente.

Contudo, este processo pode consumir bastante tempo do dia-a-dia de trabalho. Com o biblioteca Danger consegue-se automatizar parte do code review, aumentando a sua eficácia e velocidade.

Entenda como o Danger funciona, como pode ser aplicado e como podemos melhorá-lo. Conheça um caso de sua aplicação na empresa Loadsmart e quais foram os seus os resultados.

https://thedevconf.com/tdc/2018/florianopolis/trilha-ruby;jsessionid=7750FC3FCA83E1C17F7B6FB72C16A1A7

Camila Maia

April 21, 2018
Tweet

More Decks by Camila Maia

Other Decks in Technology

Transcript

  1. • An automated reviewer of your code • Ruby gem

    • Runs after your CI automating your team's conventions surrounding code review What?
  2. It is as generic as you want Like Unit Tests,

    but for your Team Culture. Formalize your Pull Request etiquette.
  3. # 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?
  4. 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
  5. 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
  6. Our Experience • Gradual integration works better • The culture

    is the most important part • It takes time to coworkers get engaged
  7. Our Experience • Pair programming • Check other projects •

    It is awesome for open source projects • Inheritance might be not that easy
  8. Why? • More flexibility: ◦ Scheduler, for example • Settings

    are more powerful ◦ Composition besides inheritance
  9. 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