<commit_before>---
title: Danger - Stop Saying "You Forgot To…" in Code Review
---

ruby:
  require 'json'
  require 'yaml'
  example_data = YAML.load(File.read "source/examples.yml")
  dangerfiles = JSON.parse(File.read('../example_oss_dangerfiles.json'))
  plugins = JSON.parse(File.read("json_data/plugins.json"))

h2
  span What is Danger?

section
  article
    markdown:
      Danger runs during your CI process, and gives teams the chance to automate common code review chores.

      This provides another logical step in your build, through this Danger can help lint your rote tasks in daily code review.

      You can use Danger to codify your teams norms. Leaving humans to think about harder problems.

      She does this by leaving messages inside your PRs based on rules that you create with the Ruby scripting language.

      Over time, as rules are adhered to, the message is amended to reflect the current state of the code review.

  article
    a href="/images/danger-screenshot.png"
      img src="/images/danger-screenshot.png" style="max-width:100%; margin-top: 15px;"
h2
 span For Example

section.examples
    ul
      - for example in example_data
        li class=example["id"] data-repos=example["repos"]
          a == example["title"]
    div
      div.code_chunk
        - for example in example_data
          div class=example["id"]
              == syntax_highlight example["code"]

      ref == ""

h2
  span What magic is this?

section
  article
    h3 How
    markdown:
      Danger is ruby gem that runs a `Dangerfile`. You set up a `Dangerfile` per-project. The `Dangerfile` contains a collection of home-grown rules specific to your project.

      Danger should be installed via a Gemfile. Add `gem "danger"` to your Gemfile, then run `bundle`.

      You can [integrate Danger](/guides/getting_started.html) into your own project on any available CI service. She will run through the process with you if you run  `danger init` after installation.

  article
    h3 Supports
    p <strong>Can run on</strong>: Circle, Travis, Jenkins, Buildkite, Semaphore, TeamCity, Xcode Bots, Drone, Surf.
    p <strong>Can chat back on</strong>: GitHub.
    p <strong>Can handle diffs from</strong>: Git.

    h3 Messaging Options
    markdown:
      `message("message")` - Comment a message to the table.

      `warn("message")` - Declares a CI warning.

      `fail("message")` - Declares a CI blocking error.

      `markdown("message")` - Outputs pure markdown under the table. 

h2
  span Plugins

section
  article
    markdown:
     Danger was built to be a small core, which allows others to extend her DSL via gems as plugins. You can create a new one with `danger plugins create`.

section.search_info
  article
    ul
      / li.search Q
      - for plugin in plugins
        li class=(plugin == plugins.first ? "highlighted" : "") data-key=plugin["instance_name"] == plugin["instance_name"] 

.plugins_search_results
  section
    == partial(:plugin_doc, locals: { plugin: plugins.first, external: true })

h2
 span Show me some Dangerfiles

section
  article
    markdown:
     Danger is used in all sorts of projects: ruby gems, python apps, xcode projects, blogs, npm websites and modules. You can check out some Dangerfiles from the Open Source community here.

section.examples
  ul
    - for repo in dangerfiles
      li class=repo  data-url="/dangerfiles/#{repo.gsub("/", "_").split("#").first}.html"
        a == repo.gsub("/", "<span>/</span>").split("#").first

  div
    div.code_chunk

    ref == ""

h2
  span Lets do it

section
  article
    markdown:
      Your first step should probably be to "[Getting Set Up](/guides/getting_started.html)", then move on to the [API Reference](/reference.html) as you build out your Dangerfile.

      If you come up with any novel uses for Danger, please tweet [@orta](https://twitter.com/orta) - and [make a plugin](/guides/creating_your_first_plugin.html) so everyone can try it. 


javascript:
    $(function() {
      /// Generic-ish Example Highlight Code
      $(".search_info ul li").click(function(event) {
        var $this = $(this)
        $this.parent().children().removeClass("highlighted")
        $this.addClass("highlighted")
        var url = "/plugins/" + $(this).data("key") + "_embed.html"
        $.get(url, function(html) {
            $(".plugins_search_results").empty()
            $(".plugins_search_results").append(html)
        })
      })

      /// Generic-ish Example Highlight Code
      $("section.examples ul li").mouseover(function(event) {
        event.preventDefault()

        // Set the corresponding code
        var klass = $(this).attr("class").replace(" highlighted", "")

        // Set selection
        $(this).parent().children().removeClass("scope_code").removeClass("highlighted")
        $(this).addClass("highlighted")

        var parent = $(this).parents("section")
        // Is this selector for switching existing code samples?
        if ($(this).data("repos")) {
          $("div.code_chunk > div", parent).css("display", "none")
          $("div.code_chunk div." + klass, parent).css("display", "block")
        } else if( $(this).data("url") ) {
          $.get( $(this).data("url"), function(html) {
              $("div.code_chunk", parent).empty()
              $("div.code_chunk", parent).append(html)
          })
        }

         // Figure out the reference text
       var urls = $(this).data("repos") && $(this).data("repos").split(", ")
       var prs = "" //$(this).data("prs").split(", ")
       var toGithubLink = function(ref) {
           var branch = (ref.indexOf("#") > -1) ? ref.split("#")[1] : "master"
           var repo = ref.split("#")[0]
           return "<a href='https://github.com/" + repo + "/blob/" + branch +"/Dangerfile'>" + repo + "</a>"
        }
        var showArray = function(array) {<commit_msg>open github links in new window/tab<commit_after>---
title: Danger - Stop Saying "You Forgot To…" in Code Review
---

ruby:
  require 'json'
  require 'yaml'
  example_data = YAML.load(File.read "source/examples.yml")
  dangerfiles = JSON.parse(File.read('../example_oss_dangerfiles.json'))
  plugins = JSON.parse(File.read("json_data/plugins.json"))

h2
  span What is Danger?

section
  article
    markdown:
      Danger runs during your CI process, and gives teams the chance to automate common code review chores.

      This provides another logical step in your build, through this Danger can help lint your rote tasks in daily code review.

      You can use Danger to codify your teams norms. Leaving humans to think about harder problems.

      She does this by leaving messages inside your PRs based on rules that you create with the Ruby scripting language.

      Over time, as rules are adhered to, the message is amended to reflect the current state of the code review.

  article
    a href="/images/danger-screenshot.png"
      img src="/images/danger-screenshot.png" style="max-width:100%; margin-top: 15px;"
h2
 span For Example

section.examples
    ul
      - for example in example_data
        li class=example["id"] data-repos=example["repos"]
          a == example["title"]
    div
      div.code_chunk
        - for example in example_data
          div class=example["id"]
              == syntax_highlight example["code"]

      ref == ""

h2
  span What magic is this?

section
  article
    h3 How
    markdown:
      Danger is ruby gem that runs a `Dangerfile`. You set up a `Dangerfile` per-project. The `Dangerfile` contains a collection of home-grown rules specific to your project.

      Danger should be installed via a Gemfile. Add `gem "danger"` to your Gemfile, then run `bundle`.

      You can [integrate Danger](/guides/getting_started.html) into your own project on any available CI service. She will run through the process with you if you run  `danger init` after installation.

  article
    h3 Supports
    p <strong>Can run on</strong>: Circle, Travis, Jenkins, Buildkite, Semaphore, TeamCity, Xcode Bots, Drone, Surf.
    p <strong>Can chat back on</strong>: GitHub.
    p <strong>Can handle diffs from</strong>: Git.

    h3 Messaging Options
    markdown:
      `message("message")` - Comment a message to the table.

      `warn("message")` - Declares a CI warning.

      `fail("message")` - Declares a CI blocking error.

      `markdown("message")` - Outputs pure markdown under the table. 

h2
  span Plugins

section
  article
    markdown:
     Danger was built to be a small core, which allows others to extend her DSL via gems as plugins. You can create a new one with `danger plugins create`.

section.search_info
  article
    ul
      / li.search Q
      - for plugin in plugins
        li class=(plugin == plugins.first ? "highlighted" : "") data-key=plugin["instance_name"] == plugin["instance_name"] 

.plugins_search_results
  section
    == partial(:plugin_doc, locals: { plugin: plugins.first, external: true })

h2
 span Show me some Dangerfiles

section
  article
    markdown:
     Danger is used in all sorts of projects: ruby gems, python apps, xcode projects, blogs, npm websites and modules. You can check out some Dangerfiles from the Open Source community here.

section.examples
  ul
    - for repo in dangerfiles
      li class=repo  data-url="/dangerfiles/#{repo.gsub("/", "_").split("#").first}.html"
        a == repo.gsub("/", "<span>/</span>").split("#").first

  div
    div.code_chunk

    ref == ""

h2
  span Lets do it

section
  article
    markdown:
      Your first step should probably be to "[Getting Set Up](/guides/getting_started.html)", then move on to the [API Reference](/reference.html) as you build out your Dangerfile.

      If you come up with any novel uses for Danger, please tweet [@orta](https://twitter.com/orta) - and [make a plugin](/guides/creating_your_first_plugin.html) so everyone can try it. 


javascript:
    $(function() {
      /// Generic-ish Example Highlight Code
      $(".search_info ul li").click(function(event) {
        var $this = $(this)
        $this.parent().children().removeClass("highlighted")
        $this.addClass("highlighted")
        var url = "/plugins/" + $(this).data("key") + "_embed.html"
        $.get(url, function(html) {
            $(".plugins_search_results").empty()
            $(".plugins_search_results").append(html)
        })
      })

      /// Generic-ish Example Highlight Code
      $("section.examples ul li").mouseover(function(event) {
        event.preventDefault()

        // Set the corresponding code
        var klass = $(this).attr("class").replace(" highlighted", "")

        // Set selection
        $(this).parent().children().removeClass("scope_code").removeClass("highlighted")
        $(this).addClass("highlighted")

        var parent = $(this).parents("section")
        // Is this selector for switching existing code samples?
        if ($(this).data("repos")) {
          $("div.code_chunk > div", parent).css("display", "none")
          $("div.code_chunk div." + klass, parent).css("display", "block")
        } else if( $(this).data("url") ) {
          $.get( $(this).data("url"), function(html) {
              $("div.code_chunk", parent).empty()
              $("div.code_chunk", parent).append(html)
          })
        }

         // Figure out the reference text
       var urls = $(this).data("repos") && $(this).data("repos").split(", ")
       var prs = "" //$(this).data("prs").split(", ")
       var toGithubLink = function(ref) {
           var branch = (ref.indexOf("#") > -1) ? ref.split("#")[1] : "master"
           var repo = ref.split("#")[0]
           return "<a href='https://github.com/" + repo + "/blob/" + branch +"/Dangerfile' target='_blank'>" + repo + "</a>"
        }
        var showArray = function(array) {
{'fraction_non_alphanumeric': 0.12730346576500423, 'fraction_numerical': 0.002874049027895182, 'mean_word_length': 2.8115335051546393, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '900848', 'n_tokens_mistral': 3500, 'n_tokens_neox': 3316, 'n_words': 1158}