gitlab-dangerfiles 3.12.0 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edf969f524278d280762935cb8a04c78a22180296c3b7e88deb342ab8f83c840
4
- data.tar.gz: 6b3b3c493beb17172786cefaa6e6ac1dd1ef243234b5e90e632b79830a7fae9c
3
+ metadata.gz: fae45cdf2a0c840f86b2d1864e521587210e4f365d2d03727be0d73866e4379c
4
+ data.tar.gz: a8380520fe8d4d12be578493244570265023db9f850ff374cd879591fb533b02
5
5
  SHA512:
6
- metadata.gz: 56e849f993eec188646a8f06106855409146070234b158c8cd48abe0378008c9d1c957dafbb1af6dbee4f86744014d1a852bc426993337f8b9978b9e7cdcdd80
7
- data.tar.gz: 19f31baf98812c924fc62d88cdc601f0f73a0c9e0c239647e25d6e79c6a1a4eaec831397658883b9cc9aff70e0fabee8e3f4df0908f119c0262788296097793e
6
+ metadata.gz: 178104293164685aa9b265505785872372ad621b92b15fca37a590be070e7abbfd4090c339f3869c1c9e4da56281800b479c96c6992fb141e358320944e508ab
7
+ data.tar.gz: bb6f9c2b409a904517d7f8e91918ddc7df959de37b41a25cd898398749d227e5b40755669a406e3bd8063df255f8639d5fccdef37c2cd150cad31e6c3d036f11
data/.rubocop.yml CHANGED
@@ -20,7 +20,7 @@ Layout/LineLength:
20
20
  Enabled: false
21
21
 
22
22
  RSpec/MultipleMemoizedHelpers:
23
- Max: 30
23
+ Max: 35
24
24
 
25
25
  RSpec/FilePath:
26
26
  Enabled: false
@@ -478,6 +478,7 @@ module Danger
478
478
 
479
479
  def current_milestone
480
480
  @current_milestone ||= gitlab_helper.api.group_milestones(GITLAB_ORG_GROUP_ID, state: "active")
481
+ .auto_paginate
481
482
  .select { |m| m.title.match?(/\A\d+\.\d+\z/) && !m.expired && m.start_date && m.due_date }
482
483
  .min_by(&:start_date)
483
484
  end
@@ -49,14 +49,6 @@ module Danger
49
49
  categories
50
50
  end
51
51
 
52
- def assign_pedroms_for_ux_wider_community_contribution(spins)
53
- # We want at least a UX reviewer who can review any wider community
54
- # contribution even without a team designer. We assign this to Pedro.
55
- ux_spin = look_for_fallback_designer_for_ux_wider_community_contribution?(spins)
56
-
57
- ux_spin && ux_spin.reviewer = teammate_pedroms
58
- end
59
-
60
52
  # Finds the +Gitlab::Dangerfiles::Teammate+ object whose username matches the MR author username.
61
53
  #
62
54
  # @return [Gitlab::Dangerfiles::Teammate]
@@ -72,7 +64,7 @@ module Danger
72
64
  #
73
65
  # @return [Array<Spin>]
74
66
  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
75
- def spin(project = nil, categories = [:none])
67
+ def spin(project = nil, categories = [:none], ux_fallback_wider_community_reviewer: teammate_pedroms)
76
68
  project = (project || config_project_name).downcase
77
69
  categories = categories.map { |category| category&.downcase || :none }
78
70
  categories.reject! { |category| import_and_integrate_reject_category?(category, project) }
@@ -120,6 +112,13 @@ module Danger
120
112
  spin.optional_role = :maintainer
121
113
  when :ux
122
114
  spin.optional_role = :maintainer
115
+
116
+ # We want at least a UX reviewer who can review any wider community
117
+ # contribution even without a team designer. We assign this to Pedro.
118
+ spin.reviewer = ux_fallback_wider_community_reviewer if
119
+ labels.include?("Community contribution") &&
120
+ spin.reviewer.nil? &&
121
+ spin.maintainer.nil?
123
122
  end
124
123
  end
125
124
 
@@ -285,7 +284,6 @@ module Danger
285
284
  end
286
285
 
287
286
  def prepare_ux_category!(categories)
288
- # Ensure to spin for UX reviewer when ~UX is applied (e.g. to review changes to the UI)
289
287
  if labels.include?("Community contribution")
290
288
  categories << :ux
291
289
  else
@@ -297,7 +295,9 @@ module Danger
297
295
  # there's no designer for this team.
298
296
  labels << "Community contribution"
299
297
 
300
- ux_spin = spin(nil, [:ux]).first
298
+ # Don't use a fallback reviewer so when a group doesn't have
299
+ # available reviewers, it'll not give us any reviewers.
300
+ ux_spin = spin(nil, [:ux], ux_fallback_wider_community_reviewer: nil).first
301
301
 
302
302
  categories << :ux if ux_spin.reviewer || ux_spin.maintainer
303
303
  ensure
@@ -307,15 +307,6 @@ module Danger
307
307
  end
308
308
  end
309
309
 
310
- def look_for_fallback_designer_for_ux_wider_community_contribution?(spins)
311
- labels.include?("Community contribution") &&
312
- spins.find do |spin|
313
- spin.category == :ux &&
314
- spin.reviewer.nil? &&
315
- spin.maintainer.nil?
316
- end
317
- end
318
-
319
310
  # Fetches the given +url+ and parse its response as JSON.
320
311
  #
321
312
  # @param [String] url
@@ -87,10 +87,6 @@ if changes.any?
87
87
  show_category_column = categories.size > 1 || categories.first != :none
88
88
  random_roulette_spins = roulette.spin(nil, categories)
89
89
 
90
- if categories.include?(:ux)
91
- roulette.assign_pedroms_for_ux_wider_community_contribution(random_roulette_spins)
92
- end
93
-
94
90
  rows = random_roulette_spins.map do |spin|
95
91
  markdown_row_for_spins(spin.category, [spin], show_category_column: show_category_column)
96
92
  end
@@ -78,27 +78,19 @@ module Gitlab
78
78
  super &&
79
79
 
80
80
  if labels.any?("Community contribution")
81
- can_review_wider_community_contribution?(teammate)
81
+ # We want the designer for the team to review the wider community
82
+ # contribution because they're more familiar with that area.
83
+ the_designer_for_the_team?(teammate)
82
84
  else
83
- can_review_team_memeber_contribution?(teammate)
85
+ # We don't want the designer for the team to review merge
86
+ # requests for the same team which is designed by themselves.
87
+ # So they can only review if they're not the designer for the team.
88
+ !the_designer_for_the_team?(teammate)
84
89
  end
85
90
  end
86
91
 
87
92
  private
88
93
 
89
- def can_review_wider_community_contribution?(teammate)
90
- # We want the designer for the team to review the wider community
91
- # contribution because they're more familiar with that area.
92
- the_designer_for_the_team?(teammate)
93
- end
94
-
95
- def can_review_team_memeber_contribution?(teammate)
96
- # We don't want the designer for the team to review merge
97
- # requests for the same team which is designed by themselves.
98
- # So they can only review if they're not the designer for the team.
99
- !the_designer_for_the_team?(teammate)
100
- end
101
-
102
94
  def the_designer_for_the_team?(teammate)
103
95
  # Pick corresponding group for community contribution
104
96
  # Specialty can be:
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "3.12.0"
3
+ VERSION = "3.13.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-dangerfiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.0
4
+ version: 3.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-14 00:00:00.000000000 Z
11
+ date: 2023-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake