Skip to content

Commit 5003530

Browse files
authored
Merge pull request #2 from robertodr/master
Refactor
2 parents 98f408c + 4971913 commit 5003530

File tree

4 files changed

+43
-9
lines changed

4 files changed

+43
-9
lines changed

Dangerfile

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
# Sometimes it's a README fix, or something like that - which isn't relevant for
2-
# including in a project's CHANGELOG for example
1+
# Adapted from https://github.com/capistrano/danger/blob/master/Dangerfile
2+
# Q: What is a Dangerfile, anyway? A: See http://danger.systems/
3+
4+
# ------------------------------------------------------------------------------
5+
# Additional pull request data
6+
# ------------------------------------------------------------------------------
7+
pr_number = github.pr_json["number"]
8+
pr_url = github.pr_json["_links"]["html"]["href"]
9+
# Sometimes its a README fix, or something like that - which isn't relevant for
10+
# including in a CHANGELOG for example
311
declared_trivial = github.pr_title.include? "#trivial"
412

5-
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
13+
# Just to let people know
614
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
715

8-
# Warn when there is a big PR
9-
warn("Big PR") if git.lines_of_code > 500
16+
# Ensure a clean commits history
17+
if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}'/ }
18+
fail('Please rebase to get rid of the merge commits in this PR')
19+
end
20+
21+
commit_lint.check
22+
23+
lgtm.check_lgtm
1024

11-
# Don't let testing shortcuts get into master by accident
12-
fail("fdescribe left in tests") if `grep -r fdescribe specs/ `.length > 1
13-
fail("fit left in tests") if `grep -r fit specs/ `.length > 1
25+
the_coding_love.random

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
source "https://rubygems.org"
33

44
gem "danger"
5+
gem "danger-commit_lint"
6+
gem "danger-lgtm"
7+
gem "danger-the_coding_love"

Gemfile.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,26 @@ GEM
2222
kramdown (~> 1.5)
2323
octokit (~> 4.7)
2424
terminal-table (~> 1)
25+
danger-commit_lint (0.0.6)
26+
danger (~> 5.0)
27+
danger-lgtm (0.2.0)
28+
danger-plugin-api (~> 1.0)
29+
danger-plugin-api (1.0.0)
30+
danger (> 2.0)
31+
danger-the_coding_love (0.0.4)
32+
danger-plugin-api (~> 1.0)
33+
nokogiri
2534
faraday (0.12.2)
2635
multipart-post (>= 1.2, < 3)
2736
faraday-http-cache (1.3.1)
2837
faraday (~> 0.8)
2938
git (1.3.0)
3039
kramdown (1.14.0)
40+
mini_portile2 (2.2.0)
3141
multipart-post (2.0.0)
3242
nap (1.1.0)
43+
nokogiri (1.8.0)
44+
mini_portile2 (~> 2.2.0)
3345
octokit (4.7.0)
3446
sawyer (~> 0.8.0, >= 0.5.3)
3547
open4 (1.3.4)
@@ -46,6 +58,9 @@ PLATFORMS
4658

4759
DEPENDENCIES
4860
danger
61+
danger-commit_lint
62+
danger-lgtm
63+
danger-the_coding_love
4964

5065
BUNDLED WITH
5166
1.14.4

hello_world.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#include <cstdlib>
22
#include <iostream>
33

4+
std::string message() {
5+
return "Hello, Danger world!";
6+
}
7+
48
int main() {
5-
std::cout << "Hello, Danger world!" << std::endl;
9+
std::cout << message() << std::endl;
610
return EXIT_SUCCESS;
711
}

0 commit comments

Comments
 (0)