From b0e2f06a8bd6969eb83b33c553ae16edb204199c Mon Sep 17 00:00:00 2001
From: nrew225 <nrew225@gmail.com>
Date: Tue, 25 Oct 2016 14:24:45 -0700
Subject: [PATCH] Add Danger

---
 .travis.yml |  4 +++-
 Dangerfile  | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 Dangerfile

diff --git a/.travis.yml b/.travis.yml
index 5756f2ed..6d69d086 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,12 +6,14 @@ node_js:
 before_install:
   - rvm install 2.2
   - gem install awesome_bot
+  - gem install danger
 script:
   - node test.js
   - awesome_bot README.md --allow-dupe --allow-redirect --allow-ssl -w notepad.cc,www.invoiceplane.com,proxy.donttrustrobots.nl,demo.phproject.org,dev.webtrees.net
+  - danger
   #Whitelisted              Reason
   #www.invoiceplane.com     awesome_bot receives error 500, works fine from browser
   #notepad.cc               not an actual link, mentioned in description
   #proxy.donttrustrobots.nl site down, issue submitted: https://github.com/swiperproxy/swiperproxy/issues/27
   #demo.phproject.org       server issues, issue submitted: https://github.com/Alanaktion/phproject/issues/257
-  #dev.webtrees.net         403 error only in trvis ci, works fine from browser
\ No newline at end of file
+  #dev.webtrees.net         403 error only in trvis ci, works fine from browser
diff --git a/Dangerfile b/Dangerfile
new file mode 100644
index 00000000..9baaf96d
--- /dev/null
+++ b/Dangerfile
@@ -0,0 +1,15 @@
+
+# Ensure there is a summary for a pull request
+fail 'Please provide a summary in the Pull Request description' if github.pr_body.length < 5
+
+# Warn when there are merge commits in the diff
+warn 'Please rebase to get rid of the merge commits in this Pull Request' if git.commits.any? { |c| c.message =~ /^Merge branch 'master'/ }
+
+# Check links
+require 'json'
+results = File.read 'ab-results-README.md-markdown-table.json'
+j = JSON.parse results
+if j['error']==true
+  fail j['title']
+  markdown j['message']
+end