diff --git a/Dangerfile b/Dangerfile index d052979..5aa30ba 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,13 +1,25 @@ -# Sometimes it's a README fix, or something like that - which isn't relevant for -# including in a project's CHANGELOG for example +# Adapted from https://github.com/capistrano/danger/blob/master/Dangerfile +# Q: What is a Dangerfile, anyway? A: See http://danger.systems/ + +# ------------------------------------------------------------------------------ +# Additional pull request data +# ------------------------------------------------------------------------------ +pr_number = github.pr_json["number"] +pr_url = github.pr_json["_links"]["html"]["href"] +# Sometimes its a README fix, or something like that - which isn't relevant for +# including in a CHANGELOG for example declared_trivial = github.pr_title.include? "#trivial" -# Make it more obvious that a PR is a work in progress and shouldn't be merged yet +# Just to let people know warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]" -# Warn when there is a big PR -warn("Big PR") if git.lines_of_code > 500 +# Ensure a clean commits history +if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}'/ } + fail('Please rebase to get rid of the merge commits in this PR') +end + +commit_lint.check + +lgtm.check_lgtm -# Don't let testing shortcuts get into master by accident -fail("fdescribe left in tests") if `grep -r fdescribe specs/ `.length > 1 -fail("fit left in tests") if `grep -r fit specs/ `.length > 1 +the_coding_love.random diff --git a/Gemfile b/Gemfile index 0bd8788..39ae4b9 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,6 @@ source "https://rubygems.org" gem "danger" +gem "danger-commit_lint" +gem "danger-lgtm" +gem "danger-the_coding_love" diff --git a/Gemfile.lock b/Gemfile.lock index 54cd749..31ad2eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,14 +22,26 @@ GEM kramdown (~> 1.5) octokit (~> 4.7) terminal-table (~> 1) + danger-commit_lint (0.0.6) + danger (~> 5.0) + danger-lgtm (0.2.0) + danger-plugin-api (~> 1.0) + danger-plugin-api (1.0.0) + danger (> 2.0) + danger-the_coding_love (0.0.4) + danger-plugin-api (~> 1.0) + nokogiri faraday (0.12.2) multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) git (1.3.0) kramdown (1.14.0) + mini_portile2 (2.2.0) multipart-post (2.0.0) nap (1.1.0) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) @@ -46,6 +58,9 @@ PLATFORMS DEPENDENCIES danger + danger-commit_lint + danger-lgtm + danger-the_coding_love BUNDLED WITH 1.14.4 diff --git a/hello_world.cpp b/hello_world.cpp index 92fa5e8..743be7c 100644 --- a/hello_world.cpp +++ b/hello_world.cpp @@ -1,7 +1,11 @@ #include #include +std::string message() { + return "Hello, Danger world!"; +} + int main() { - std::cout << "Hello, Danger world!" << std::endl; + std::cout << message() << std::endl; return EXIT_SUCCESS; }