Slide 1

Slide 1 text

Cocoaheads 13.10.2016 like unit tests, but for TEAM culture ! NS

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

DANGER CREATORS Felix Krause Orta Therox Artsy, Cocoapods, danger Fastlane

Slide 4

Slide 4 text

DANGER EVANGELIST Juanito Fatas deppbot

Slide 5

Slide 5 text

WHAT

Slide 6

Slide 6 text

Tests for team culture

Slide 7

Slide 7 text

FEEDBACK SYSTEM DURING CODE REVIEW

Slide 8

Slide 8 text

FREE AND OPEN SOURCE

Slide 9

Slide 9 text

MODERN WORKFLOW ! " CI # You created a Pull Request or Merge Request

Slide 10

Slide 10 text

" CI # SCM tells CI to build MODERN WORKFLOW ! Source Control Management Continuous Integration

Slide 11

Slide 11 text

" CI # Your CI runs your Build MODERN WORKFLOW !

Slide 12

Slide 12 text

" CI # Human checks PR MODERN WORKFLOW ! $

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

" CI # DANGER checks PR POSTMODERN WORKFLOW !

Slide 15

Slide 15 text

Reports back if anything POSTMODERN WORKFLOW

Slide 16

Slide 16 text

" CI # Human Checks Important Things ! $ POSTMODERN WORKFLOW

Slide 17

Slide 17 text

! " CI # POSTMODERN WORKFLOW BETTER MERGED

Slide 18

Slide 18 text

Stop saying
 "You forgot to…" in Code Review for trivial things

Slide 19

Slide 19 text

HOWTO

Slide 20

Slide 20 text

INSTALL

Slide 21

Slide 21 text

gem "danger" INSTALL

Slide 22

Slide 22 text

TOKEN GitHub GitLab BITBUCKET server

Slide 23

Slide 23 text

Add SCM Token to Your CI TOKEN

Slide 24

Slide 24 text

DANGERFILE

Slide 25

Slide 25 text

DANGERFILE Domain Specific Language

Slide 26

Slide 26 text

Paths for files that were added during the diff added_files [String] Paths for files that were removed during the diff deleted_files [String] Paths for files that changed during the diff modified_files [String] The overall lines of code added/removed in the diff lines_of_code Int The overall lines of code removed in the diff deletions Int The overall lines of code added in the diff insertions Int The log of commits inside the diff commits Git::Log Details for a specific file in this diff diff_for_file Git::Diff::DiffFile GIT

Slide 27

Slide 27 text

The title of the Pull Request. pr_title String The body text of the Pull Request. pr_body String The username of the author of the Pull Request. pr_author String The labels assigned to the Pull Request. pr_labels String The base commit to which the PR is going to be merged as a parent. base_commit String The head commit to which the PR is requesting to be merged from. head_commit String The hash that represents the PR's JSON. pr_json Hash Provides access to an API client used inside Danger. Different per platform. api Octokit::Client GITHUB gitlab bitbucket

Slide 28

Slide 28 text

Print markdown to below the table markdown (message: String, file=nil: String, line=nil: String) Print out a generate message on the PR message (message: String, sticky=true: Boolean, file=nil: String, line=nil: String) Specifies a problem, but not critical warn (message: String, sticky=true: Boolean, file=nil: String, line=nil: String) Declares a CI blocking error fail (message: String, sticky=true: Boolean, file=nil: String, line=nil: String) A list of all messages passed to Danger, including the markdowns. status_report Hash A list of all violations passed to Danger, we don't anticipate users of Danger needing to use this. violation_report Hash MESSAGING

Slide 29

Slide 29 text

CI Bitrise Buildkite circleci Jenkins GitLab Drone Travis CI Semaphore TeamCity Surf Buildasaur

Slide 30

Slide 30 text

CI bundle exec danger CI config file .circle.yml, .travis.yml, et cetera

Slide 31

Slide 31 text

CASE

Slide 32

Slide 32 text

Artsy OPEN SOURCE https://www.objc.io/issues/22-scale/artsy/ https://github.com/artsy/eigen https://github.com/artsy/energy https://github.com/artsy/emission https://github.com/artsy/emergence (Chinese translation)

Slide 33

Slide 33 text

Artsy/eigen https://artsy.github.io

Slide 34

Slide 34 text

Warn reviewers if PR is classed as Work In Progress Enforce CHANGELOG for big changes Enforce CHANGELOG for big changes that needs test on iPhone Fail if someone accidentally committed skipped tests Fail if changes Developer Specific files Fail if changes Analytics without tests Fail if CHANGELOG is broken Fail if Snapshots fails Warn if has unstubbed network requests Warn performance outliners in PR Artsy/eigen

Slide 35

Slide 35 text

Warn reviewers if PR is classed as Work In Progress Artsy/eigen

Slide 36

Slide 36 text

Enforce CHANGELOG for big changes Enforce CHANGELOG for big changes that needs test on iPhone Artsy/eigen

Slide 37

Slide 37 text

Fail if someone accidentally committed skipped tests Artsy/eigen

Slide 38

Slide 38 text

Fail if changes Developer Specific files Artsy/eigen

Slide 39

Slide 39 text

Fail if changes Analytics without tests Artsy/eigen

Slide 40

Slide 40 text

Artsy/eigen

Slide 41

Slide 41 text

Fail if CHANGELOG is broken Artsy/eigen

Slide 42

Slide 42 text

Fail if Snapshots fails Artsy/eigen

Slide 43

Slide 43 text

Warn if unstubbed network requests Artsy/eigen

Slide 44

Slide 44 text

Warn performance outliners in PR Artsy/eigen

Slide 45

Slide 45 text

Artsy/eigen https://github.com/artsy/eigen/pull/1905

Slide 46

Slide 46 text

Spell Check Markdown Highlight JUnit Errors Highlight Xcode build issues Apply Commit Rules Enforce CHANGLOGs Only let certain developers touch some files Show slow swift compilation steps Keep your Git history short highlight undocumented methods Check if the author is in an org Ensure PR summaries Ensure each PR has a JIRA ticket Ensure developers write tests Only accept PRs to a specific branch Ensure all PRs have an assignee Warn when specific libs are added Fail big PRs Add links to build artifacts Run linters on your code, highlighting per line Ensure some files are never changed Ensure some texts are never added to files Ensure coupled files are both changed Prose check files Ensure PR title Merge OK PRs automatically

Slide 47

Slide 47 text

PLUGINS

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

SWIFTLINT

Slide 50

Slide 50 text

SWIFTLINT

Slide 51

Slide 51 text

SWIFTLINT

Slide 52

Slide 52 text

SWIFTLINT

Slide 53

Slide 53 text

USERS

Slide 54

Slide 54 text

danger/danger artsy/eigen fastlane/fastlane CocoaPods/CocoaPods moya/moya jpsim/SourceKitten mozilla-mobile/firefox-ios Buffer, Soundcloud, Jazzy, and RxSwift PIONEERS

Slide 55

Slide 55 text

TAKE DANGER WITH YOU

Slide 56

Slide 56 text

JOIN THE DANGER PARTY

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

THANK YOU @JuanitoFatas