From 48aa609e060ad6638b2212dc2dda2009f2397a26 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 27 Jan 2018 18:56:46 -0700 Subject: [PATCH 1/6] =?UTF-8?q?=E2=9E=95=F0=9F=92=8E=20Add=20danger=20gem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 1 + Gemfile.lock | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/Gemfile b/Gemfile index c40482b..e99d81d 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,5 @@ source "https://rubygems.org" gem "cocoaseeds" +gem "danger" gem "xcpretty" diff --git a/Gemfile.lock b/Gemfile.lock index 688ae01..1391b4e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,13 +2,52 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (2.3.6) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) claide (1.0.2) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) cocoaseeds (0.8.3) colored2 (~> 3.1) xcodeproj (>= 0.28) colored2 (3.1.2) + cork (0.3.0) + colored2 (~> 3.1) + danger (5.5.8) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (~> 0.9) + faraday-http-cache (~> 1.0) + git (~> 1) + kramdown (~> 1.5) + no_proxy_fix + octokit (~> 4.7) + terminal-table (~> 1) + faraday (0.14.0) + multipart-post (>= 1.2, < 3) + faraday-http-cache (1.3.1) + faraday (~> 0.8) + git (1.3.0) + kramdown (1.16.2) + multipart-post (2.0.0) nanaimo (0.2.3) + nap (1.1.0) + no_proxy_fix (0.1.2) + octokit (4.8.0) + sawyer (~> 0.8.0, >= 0.5.3) + open4 (1.3.4) + public_suffix (3.0.1) rouge (2.0.7) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + unicode-display_width (1.3.0) xcodeproj (1.5.4) CFPropertyList (~> 2.3.3) claide (>= 1.0.2, < 2.0) @@ -22,6 +61,7 @@ PLATFORMS DEPENDENCIES cocoaseeds + danger xcpretty BUNDLED WITH From 4f4c1a1e5eb8bf3e4ccf0f6dbc3b23d63fe1a21d Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 27 Jan 2018 18:58:33 -0700 Subject: [PATCH 2/6] Add Dangerfile --- Dangerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Dangerfile diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 0000000..d052979 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,13 @@ +# Sometimes it's a README fix, or something like that - which isn't relevant for +# including in a project's 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 +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 + +# 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 From 4277c9af951f568c98d939f88303e8f073f09cee Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 27 Jan 2018 20:38:41 -0700 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=91=B7=20Run=20danger=20on=20travis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7c572ee..b573b29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ install: script: - script/build + - bundle exec danger before_deploy: - script/package From ed493010952d36df64fec17a8252b8d28d76fa5c Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 27 Jan 2018 21:12:34 -0700 Subject: [PATCH 4/6] =?UTF-8?q?=E2=9A=A0=EF=B8=8FAdd=20rules=20to=20Danger?= =?UTF-8?q?file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dangerfile | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Dangerfile b/Dangerfile index d052979..2a4ecbf 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,6 +1,30 @@ # Sometimes it's a README fix, or something like that - which isn't relevant for # including in a project's CHANGELOG for example -declared_trivial = github.pr_title.include? "#trivial" +has_app_changes = !git.modified_files.grep(/mas-cli/).empty? +# has_test_changes = !git.modified_files.grep(/Tests/).empty? + +is_version_bump = git.modified_files.sort == ["CHANGELOG.md", "mas-cli/mas-cli-Info.plist"].sort +message("Version bump! :bookmark:") if is_version_bump + +# if has_app_changes && !has_test_changes && !is_version_bump +# warn("Tests were not updated", sticky: false) +# end + +# Thanks other people! +message(":tada:") if is_version_bump && github.pr_author != "phatblat" + +# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title +if github.pr_body.length < 5 + fail "Please provide a summary in the Pull Request description" +end + +# Let people say that this isn't worth a CHANGELOG entry in the PR if they choose +declared_trivial = (github.pr_title + github.pr_body).include?("#trivial") || !has_app_changes + +# Keep the CHANGELOG up-to-date +if !git.modified_files.include?("CHANGELOG.md") && !declared_trivial + fail("Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/mas-cli/mas/blob/master/CHANGELOG.md).", sticky: false) +end # Make it more obvious that a PR is a work in progress and shouldn't be merged yet warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]" @@ -9,5 +33,5 @@ warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]" warn("Big PR") if git.lines_of_code > 500 # 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 +#fail("fdescribe left in tests") if `grep -r fdescribe Tests/ `.length > 1 +#fail("fit left in tests") if `grep -r fit Tests/ `.length > 1 From 5dc39a81d5e01e5c4b26bc7dbdc9867128fe8804 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 27 Jan 2018 21:37:30 -0700 Subject: [PATCH 5/6] Add message for trivial PRs --- Dangerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dangerfile b/Dangerfile index 2a4ecbf..554cad6 100644 --- a/Dangerfile +++ b/Dangerfile @@ -20,6 +20,7 @@ end # Let people say that this isn't worth a CHANGELOG entry in the PR if they choose declared_trivial = (github.pr_title + github.pr_body).include?("#trivial") || !has_app_changes +message("This PR might seem trivial, but every contribution counts. :kissing_heart:") if declared_trivial # Keep the CHANGELOG up-to-date if !git.modified_files.include?("CHANGELOG.md") && !declared_trivial From f2eea3d29312630b29c116fa19fbf5097f0d6d95 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 27 Jan 2018 21:44:13 -0700 Subject: [PATCH 6/6] Add more moj --- Dangerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dangerfile b/Dangerfile index 554cad6..96c0ee0 100644 --- a/Dangerfile +++ b/Dangerfile @@ -4,7 +4,7 @@ has_app_changes = !git.modified_files.grep(/mas-cli/).empty? # has_test_changes = !git.modified_files.grep(/Tests/).empty? is_version_bump = git.modified_files.sort == ["CHANGELOG.md", "mas-cli/mas-cli-Info.plist"].sort -message("Version bump! :bookmark:") if is_version_bump +message(":bookmark: Version bump!") if is_version_bump # if has_app_changes && !has_test_changes && !is_version_bump # warn("Tests were not updated", sticky: false) @@ -15,7 +15,7 @@ message(":tada:") if is_version_bump && github.pr_author != "phatblat" # Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title if github.pr_body.length < 5 - fail "Please provide a summary in the Pull Request description" + fail ":memo: Please provide a summary in the Pull Request description" end # Let people say that this isn't worth a CHANGELOG entry in the PR if they choose @@ -24,14 +24,14 @@ message("This PR might seem trivial, but every contribution counts. :kissing_hea # Keep the CHANGELOG up-to-date if !git.modified_files.include?("CHANGELOG.md") && !declared_trivial - fail("Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/mas-cli/mas/blob/master/CHANGELOG.md).", sticky: false) + fail(":book: Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/mas-cli/mas/blob/master/CHANGELOG.md).", sticky: false) end # Make it more obvious that a PR is a work in progress and shouldn't be merged yet -warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]" +warn(":construction: 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 +warn(":dizzy_face: Big PR") if git.lines_of_code > 500 # Don't let testing shortcuts get into master by accident #fail("fdescribe left in tests") if `grep -r fdescribe Tests/ `.length > 1