From 38346ee2a219947337e4af8fd9236f6849291169 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 19 Feb 2024 19:50:20 +0100 Subject: [PATCH 1/4] Add Dangermattic configuration --- .github/run-danger.yml | 12 ++++++++ Dangerfile | 15 ++++++++++ Gemfile | 2 +- Gemfile.lock | 63 ++++++++++++++++++++++++++++++++++++++---- 4 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 .github/run-danger.yml create mode 100644 Dangerfile diff --git a/.github/run-danger.yml b/.github/run-danger.yml new file mode 100644 index 000000000..cb72f71ec --- /dev/null +++ b/.github/run-danger.yml @@ -0,0 +1,12 @@ +name: ☢️ Danger + +on: + pull_request: + types: [opened, reopened, ready_for_review, synchronize] + +jobs: + dangermattic: + # runs on draft PRs only for opened / synchronize events + uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@v1.0.0 + secrets: + github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }} diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 000000000..0db463164 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +github.dismiss_out_of_range_messages + +# `files: []` forces rubocop to scan all files, not just the ones modified in the PR +rubocop.lint(files: [], force_exclusion: true, inline_comment: true, fail_on_inline_comment: true, include_cop_names: true) + +manifest_pr_checker.check_all_manifest_lock_updated + +podfile_checker.check_podfile_does_not_have_branch_references + +pr_size_checker.check_diff_size( + max_size: 300, + type: :insertions +) diff --git a/Gemfile b/Gemfile index 9539d2134..d288e4837 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,6 @@ source 'https://rubygems.org' gem 'cocoapods', '~> 1.11' gem 'cocoapods-check', '~> 1.1' +gem 'danger-dangermattic', '~> 1.0' gem 'fastlane', '~> 2.189' gem 'fastlane-plugin-wpmreleasetoolkit', '~> 9.2' -gem 'rubocop', '~> 1.18' diff --git a/Gemfile.lock b/Gemfile.lock index f3c752c52..ce2f2177d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,6 +44,10 @@ GEM sawyer (>= 0.6) chroma (0.2.0) claide (1.1.0) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) cocoapods (1.14.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) @@ -89,6 +93,44 @@ GEM highline (~> 2.0.0) concurrent-ruby (1.2.2) connection_pool (2.4.1) + cork (0.3.0) + colored2 (~> 3.1) + danger (9.4.3) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (>= 0.9.0, < 3.0) + faraday-http-cache (~> 2.0) + git (~> 1.13) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.0) + no_proxy_fix + octokit (>= 4.0) + terminal-table (>= 1, < 4) + danger-dangermattic (1.0.0) + danger (~> 9.4) + danger-junit (~> 1.0) + danger-plugin-api (~> 1.0) + danger-rubocop (~> 0.12) + danger-swiftlint (~> 0.35) + danger-xcode_summary (~> 1.0) + rubocop (~> 1.60) + danger-junit (1.0.2) + danger (> 2.0) + ox (~> 2.0) + danger-plugin-api (1.0.0) + danger (> 2.0) + danger-rubocop (0.12.0) + danger + rubocop (~> 1.0) + danger-swiftlint (0.35.0) + danger + rake (> 10) + thor (~> 1.0.0) + danger-xcode_summary (1.3.0) + danger-plugin-api (~> 1.0) + xcresult (~> 0.2) declarative (0.0.20) diffy (3.4.2) digest-crc (0.6.5) @@ -120,6 +162,8 @@ GEM faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) + faraday-http-cache (2.5.1) + faraday (>= 0.8) faraday-httpclient (1.0.1) faraday-multipart (1.0.4) multipart-post (~> 2) @@ -243,6 +287,10 @@ GEM jmespath (1.6.2) json (2.7.1) jwt (2.7.1) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) language_server-protocol (3.17.0.3) mini_magick (4.12.0) mini_mime (1.1.5) @@ -256,6 +304,7 @@ GEM nap (1.1.0) naturally (2.2.1) netrc (0.11.0) + no_proxy_fix (0.1.2) nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -264,11 +313,13 @@ GEM octokit (6.1.1) faraday (>= 1, < 3) sawyer (~> 0.9) + open4 (1.3.4) options (2.3.2) optparse (0.1.1) os (1.1.4) + ox (2.14.17) parallel (1.23.0) - parser (3.2.2.4) + parser (3.3.0.5) ast (~> 2.4.1) racc plist (3.7.0) @@ -282,7 +333,7 @@ GEM rake-compiler (1.2.5) rake rchardet (1.8.0) - regexp_parser (2.8.3) + regexp_parser (2.9.0) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -290,11 +341,11 @@ GEM retriable (3.1.2) rexml (3.2.6) rouge (2.0.7) - rubocop (1.59.0) + rubocop (1.60.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) @@ -322,6 +373,7 @@ GEM terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) + thor (1.0.1) trailblazer-option (0.1.2) tty-cursor (0.7.1) tty-screen (0.8.1) @@ -346,6 +398,7 @@ GEM rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) + xcresult (0.2.1) PLATFORMS ruby @@ -355,9 +408,9 @@ PLATFORMS DEPENDENCIES cocoapods (~> 1.11) cocoapods-check (~> 1.1) + danger-dangermattic (~> 1.0) fastlane (~> 2.189) fastlane-plugin-wpmreleasetoolkit (~> 9.2) - rubocop (~> 1.18) BUNDLED WITH 2.3.24 From 4da6af7dbc9dfd44df11de5dbf8842b8b13a7c82 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 20 Feb 2024 12:43:55 +1100 Subject: [PATCH 2/4] Move the Danger workflow in `.github/workflows` as per docs https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions --- .github/{ => workflows}/run-danger.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/run-danger.yml (100%) diff --git a/.github/run-danger.yml b/.github/workflows/run-danger.yml similarity index 100% rename from .github/run-danger.yml rename to .github/workflows/run-danger.yml From 85de34960bb1633779d84e898468f0429968e260 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 20 Feb 2024 12:58:23 +1100 Subject: [PATCH 3/4] Hack to get RuboCop warning and Danger message --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d288e4837..49cec7dba 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,9 @@ source 'https://rubygems.org' -gem 'cocoapods', '~> 1.11' gem 'cocoapods-check', '~> 1.1' gem 'danger-dangermattic', '~> 1.0' gem 'fastlane', '~> 2.189' gem 'fastlane-plugin-wpmreleasetoolkit', '~> 9.2' +# out of order to get a RuboCop warning +gem 'cocoapods', '~> 1.11' From 62dc65378a0856c7c046b8ff8b9680b307cd6e28 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 20 Feb 2024 13:30:30 +1100 Subject: [PATCH 4/4] Turns out the violation introduced before wasn't one --- Gemfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Gemfile b/Gemfile index 49cec7dba..072e26bdb 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,11 @@ # frozen_string_literal: true + + + + + + source 'https://rubygems.org' gem 'cocoapods-check', '~> 1.1'