From 3a975f912159a025d2ba011dae53a826bba897a9 Mon Sep 17 00:00:00 2001 From: Karl Catigbe Date: Mon, 25 Feb 2019 10:50:04 -0500 Subject: [PATCH 1/5] Adding Danger --- Dangerfile | 13 +++++++++++++ Gemfile | 8 ++++++++ Gemfile.lock | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 Dangerfile create mode 100644 Gemfile create mode 100644 Gemfile.lock 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 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..1a96278 --- /dev/null +++ b/Gemfile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } + +# gem "rails" +gem 'danger' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..e9027fd --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,53 @@ +GEM + remote: https://rubygems.org/ + specs: + 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) + colored2 (3.1.2) + cork (0.3.0) + colored2 (~> 3.1) + danger (5.15.0) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (~> 0.9) + faraday-http-cache (~> 1.0) + git (~> 1.5) + kramdown (~> 1.5) + no_proxy_fix + octokit (~> 4.7) + terminal-table (~> 1) + faraday (0.15.4) + multipart-post (>= 1.2, < 3) + faraday-http-cache (1.3.1) + faraday (~> 0.8) + git (1.5.0) + kramdown (1.17.0) + multipart-post (2.0.0) + nap (1.1.0) + no_proxy_fix (0.1.2) + octokit (4.13.0) + sawyer (~> 0.8.0, >= 0.5.3) + open4 (1.3.4) + public_suffix (3.0.3) + 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.4.1) + +PLATFORMS + ruby + +DEPENDENCIES + danger + +BUNDLED WITH + 2.0.1 From 02512acf819972e2c01bea9a01f40ba5e2f4dd2f Mon Sep 17 00:00:00 2001 From: Karl Catigbe Date: Mon, 25 Feb 2019 11:17:38 -0500 Subject: [PATCH 2/5] More Danger --- Dangerfile | 10 ++++++++++ Gemfile | 2 ++ Gemfile.lock | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/Dangerfile b/Dangerfile index d052979..6fa0d0a 100644 --- a/Dangerfile +++ b/Dangerfile @@ -11,3 +11,13 @@ 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 + +# Coverage +report = xcov.report( + scheme: 'iOS Tests', + project: 'MulticastDelegate.xcodeproj', + minimum_coverage_percentage: 80 +) + +#Coding Love +the_coding_love.random diff --git a/Gemfile b/Gemfile index 1a96278..24020f7 100644 --- a/Gemfile +++ b/Gemfile @@ -6,3 +6,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } # gem "rails" gem 'danger' +gem 'danger-the_coding_love' +gem 'danger-xcov' diff --git a/Gemfile.lock b/Gemfile.lock index e9027fd..58979c2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,9 +8,17 @@ GEM cork nap open4 (~> 1.3) + colored (1.2) colored2 (3.1.2) + commander (4.4.7) + highline (~> 2.0.0) cork (0.3.0) colored2 (~> 3.1) + credentials_manager (0.16.4) + colored + commander (>= 4.3.5) + highline (>= 1.7.1) + security danger (5.15.0) claide (~> 1.0) claide-plugins (>= 0.9.2) @@ -23,31 +31,69 @@ GEM no_proxy_fix octokit (~> 4.7) terminal-table (~> 1) + danger-plugin-api (1.0.0) + danger (> 2.0) + danger-the_coding_love (0.0.6) + danger-plugin-api (~> 1.0) + nokogiri (>= 1.8.5) + danger-xcov (0.2.2) + danger (>= 2.1) + xcov (>= 0.9) + excon (0.62.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) + fastlane_core (0.59.0) + colored + commander (>= 4.4.0, <= 5.0.0) + credentials_manager (>= 0.16.2, < 1.0.0) + excon (>= 0.45.0, < 1.0) + gh_inspector (>= 1.0.1, < 2.0.0) + highline (>= 1.7.2) + json + multi_json + plist (>= 3.1.0, < 4.0.0) + rubyzip (~> 1.1.6) + terminal-table (>= 1.4.5, < 2.0.0) + gh_inspector (1.1.3) git (1.5.0) + highline (2.0.1) + json (2.2.0) kramdown (1.17.0) + mini_portile2 (2.4.0) + multi_json (1.13.1) multipart-post (2.0.0) nap (1.1.0) no_proxy_fix (0.1.2) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) octokit (4.13.0) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) + plist (3.5.0) public_suffix (3.0.3) + rubyzip (1.1.7) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) + security (0.1.3) + slack-notifier (1.5.1) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (1.4.1) + xcov (0.12.3) + fastlane_core (>= 0.7, < 1.0.0) + slack-notifier (~> 1.3) + terminal-table PLATFORMS ruby DEPENDENCIES danger + danger-the_coding_love + danger-xcov BUNDLED WITH 2.0.1 From 933f05c25462aa2b9675efb3d0d046ba551b2f28 Mon Sep 17 00:00:00 2001 From: Karl Catigbe Date: Mon, 25 Feb 2019 11:38:22 -0500 Subject: [PATCH 3/5] Removing xcov since it's really outdated --- Dangerfile | 7 ------- Gemfile | 1 - Gemfile.lock | 37 ------------------------------------- 3 files changed, 45 deletions(-) diff --git a/Dangerfile b/Dangerfile index 6fa0d0a..1111c63 100644 --- a/Dangerfile +++ b/Dangerfile @@ -12,12 +12,5 @@ warn("Big PR") if git.lines_of_code > 500 fail("fdescribe left in tests") if `grep -r fdescribe specs/ `.length > 1 fail("fit left in tests") if `grep -r fit specs/ `.length > 1 -# Coverage -report = xcov.report( - scheme: 'iOS Tests', - project: 'MulticastDelegate.xcodeproj', - minimum_coverage_percentage: 80 -) - #Coding Love the_coding_love.random diff --git a/Gemfile b/Gemfile index 24020f7..a6dee13 100644 --- a/Gemfile +++ b/Gemfile @@ -7,4 +7,3 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } # gem "rails" gem 'danger' gem 'danger-the_coding_love' -gem 'danger-xcov' diff --git a/Gemfile.lock b/Gemfile.lock index 58979c2..539f47d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,17 +8,9 @@ GEM cork nap open4 (~> 1.3) - colored (1.2) colored2 (3.1.2) - commander (4.4.7) - highline (~> 2.0.0) cork (0.3.0) colored2 (~> 3.1) - credentials_manager (0.16.4) - colored - commander (>= 4.3.5) - highline (>= 1.7.1) - security danger (5.15.0) claide (~> 1.0) claide-plugins (>= 0.9.2) @@ -36,33 +28,13 @@ GEM danger-the_coding_love (0.0.6) danger-plugin-api (~> 1.0) nokogiri (>= 1.8.5) - danger-xcov (0.2.2) - danger (>= 2.1) - xcov (>= 0.9) - excon (0.62.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) - fastlane_core (0.59.0) - colored - commander (>= 4.4.0, <= 5.0.0) - credentials_manager (>= 0.16.2, < 1.0.0) - excon (>= 0.45.0, < 1.0) - gh_inspector (>= 1.0.1, < 2.0.0) - highline (>= 1.7.2) - json - multi_json - plist (>= 3.1.0, < 4.0.0) - rubyzip (~> 1.1.6) - terminal-table (>= 1.4.5, < 2.0.0) - gh_inspector (1.1.3) git (1.5.0) - highline (2.0.1) - json (2.2.0) kramdown (1.17.0) mini_portile2 (2.4.0) - multi_json (1.13.1) multipart-post (2.0.0) nap (1.1.0) no_proxy_fix (0.1.2) @@ -71,21 +43,13 @@ GEM octokit (4.13.0) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) - plist (3.5.0) public_suffix (3.0.3) - rubyzip (1.1.7) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) - security (0.1.3) - slack-notifier (1.5.1) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (1.4.1) - xcov (0.12.3) - fastlane_core (>= 0.7, < 1.0.0) - slack-notifier (~> 1.3) - terminal-table PLATFORMS ruby @@ -93,7 +57,6 @@ PLATFORMS DEPENDENCIES danger danger-the_coding_love - danger-xcov BUNDLED WITH 2.0.1 From dbe8014132ac18f04ad20caf31d53a5cc170e81a Mon Sep 17 00:00:00 2001 From: Karl Catigbe Date: Wed, 27 Feb 2019 12:58:00 -0500 Subject: [PATCH 4/5] Updating danger to parse the template --- Dangerfile | 59 ++++++++++++++++++++++++++++++++++++++++++++++------ Gemfile | 2 +- Gemfile.lock | 2 +- 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/Dangerfile b/Dangerfile index 1111c63..511754c 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,16 +1,63 @@ +def validate_template(pr_body) + + failure("You did not complete the `Type of change(s)` checklist") if !meets_types_lines(pr_body) + failure("You did not complete the `Before you begin` checklist") if !meets_required_lines(pr_body) + +end + +def meets_required_lines(pr_body) + lines = Array.new + + pr_body.each_line do |line| + if line.include?(" -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] Hotfix / Breakfix (fix or feature that would cause existing functionality to change) -- [ ] Refactoring (changes in code organization without major change in functionality) -- [ ] Documentation addition / update (changes in stored documentation that does not affect functionality) -- [ ] CI/CD change (changes to any versioned CI related configuration / tools) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] Hotfix / Breakfix (fix or feature that would cause existing functionality to change) +- [ ] Refactoring (changes in code organization without major change in functionality) +- [ ] Documentation addition / update (changes in stored documentation that does not affect functionality) +- [ ] CI/CD change (changes to any versioned CI related configuration / tools) ## Before You Begin - -- [ ] Builds clean without any errors? -- [ ] Jira ticket URL has been added to the title above (e.g. CNBCMAPP-420) -- [ ] I have added / updated tests to cover my changes. -- [ ] Have all new and existing tests passed? -- [ ] I have updated the documentation accordingly. -- [ ] Has this been signed off by Product or Design? +- [ ] Builds clean without any errors? +- [ ] Jira ticket URL has been added to the title above (e.g. CNBCMAPP-420) +- [ ] I have added / updated tests to cover my changes. +- [ ] Have all new and existing tests passed? +- [ ] I have updated the documentation accordingly. +- [ ] Has this been signed off by Product or Design? ##### If any of the above are not checked please explain why: -## Description of Your Changes +## Description of Your Changes ## How Has This Been Tested? - Provide the steps to test this -## Device / Form Factor Checklist +## Device / Form Factor Checklist This PR has been tested with the following devices: - +- [ ] Not Applicable - [ ] iPhone - [ ] Large (Plus, Max) - [ ] X (X, Xr, Xs) @@ -56,14 +53,11 @@ This PR has been tested with the following devices: ## Screenshots (if appropriate): ## Dependencies - Provide details on other PRs that are dependent on this / this PR is dependent on: ## Documentation - If you created / updated documentation, necessary documentation & links (if applicable): ## Notes - - + \ No newline at end of file