gitlab-dangerfiles 4.9.0 → 4.9.1

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: 98bba3bef6a0636a636a8b1e038baf11ac64f9b2139a7196990a093cd94c11e7
4
- data.tar.gz: 6b65192e78b836b3efac843ea670560d2a169b3bd1135989bc968ce0fdc089a3
3
+ metadata.gz: 833ebf65ece50022cfe565242ddb8af684071fdd9abab0d24f94fdf3331b8c37
4
+ data.tar.gz: 10782785c698f9a32ff8f215cbdf1e8407ce5c85caf7f60faa69ff234748b635
5
5
  SHA512:
6
- metadata.gz: 3f46e0a6ac334fe988c303bcb12b7bb58ecd2162fe5c5c3a8547b165e6037e535a4fa9308ec2503c421fdc3a09f8fd66d2702c79375585b99325d399bf65750f
7
- data.tar.gz: d024b3cb5fc602e1811bb3692cd559119ae653827c06c9051c8e858f200c23f6a8f059193289d33d3e7e7d8f3ea247dee19fc9a20f96e66a0e8f1416bb29b9bf
6
+ metadata.gz: bb2ffba4936cdb33385fb88eec7958bc56b87cce7735c8fc59c79afdb73ccb88e0817cf567a63378612602ba54a2236b029a2059d831933ad72b2db4f4c9d17a
7
+ data.tar.gz: 22bffdd675c0254a09504a00dcb4fbc949f53f53f0b814e1b1accf500c7e571c022a866256ec60e0f666ffb401fd4a44650f3c88139e539e8ce59c434bc0d45d
@@ -2,7 +2,7 @@
2
2
  commit from this merge request, and `<NEW_VERSION>` with the upcoming version number. -->
3
3
  ## Diff
4
4
 
5
- https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/-/compare/v<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
5
+ https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/-/compare/<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
6
6
 
7
7
  ## Checklist
8
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-dangerfiles (4.9.0)
4
+ gitlab-dangerfiles (4.9.1)
5
5
  danger (>= 9.3.0)
6
6
  danger-gitlab (>= 8.0.0)
7
7
  rake (~> 13.0)
@@ -117,6 +117,7 @@ GEM
117
117
  parallel (1.22.1)
118
118
  parser (3.2.1.0)
119
119
  ast (~> 2.4.1)
120
+ racc
120
121
  proc_to_ast (0.1.0)
121
122
  coderay
122
123
  parser
@@ -125,6 +126,7 @@ GEM
125
126
  coderay (~> 1.1)
126
127
  method_source (~> 1.0)
127
128
  public_suffix (5.0.1)
129
+ racc (1.8.1)
128
130
  rack (3.0.4.1)
129
131
  rainbow (3.1.1)
130
132
  rake (13.0.6)
@@ -220,6 +222,7 @@ DEPENDENCIES
220
222
  gitlab-styles (~> 10.0)
221
223
  guard-rspec (~> 4.7.3)
222
224
  lefthook (~> 1.3)
225
+ racc (~> 1.8)
223
226
  rspec (~> 3.8)
224
227
  rspec-parameterized
225
228
  rubocop-rails (< 2.21.2)
data/README.md CHANGED
@@ -336,8 +336,8 @@ For example, to test `gitlab-dangerfiles` changes from the `your-branch-name` br
336
336
 
337
337
  ```ruby
338
338
  group :development, :test, :danger do
339
- gem 'gitlab-dangerfiles', '~> 3.4.3', require: false,
340
- git: 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles.git',
339
+ gem 'gitlab-dangerfiles', require: false, feature_category: :tooling,
340
+ git: 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles.git', # rubocop:disable Cop/GemFetcher -- Testing unreleased changes
341
341
  ref: 'your-branch-name'
342
342
  end
343
343
  ```
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency "lefthook", "~> 1.3"
38
38
  spec.add_development_dependency "rspec-parameterized"
39
39
  spec.add_development_dependency "rspec", "~> 3.8"
40
+ spec.add_development_dependency "racc", "~> 1.8"
40
41
  # we do not commit the bundle lockfile, so this temporary workaround needs to be
41
42
  # present until 2.21.3 or 2.22.x is released
42
43
  # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/63
@@ -45,7 +45,7 @@ module Danger
45
45
  # @param categories [Array<Symbol>] An array of categories symbols.
46
46
  #
47
47
  # @return [Array<Spin>]
48
- def spin(project = nil, categories = [:none], ux_fallback_wider_community_reviewer: teammate_pedroms)
48
+ def spin(project = nil, categories = [:none], ux_fallback_wider_community_reviewer: ux_fallback_reviewer)
49
49
  # TODO: Deprecate the project argument. It prevents us from
50
50
  # memorizing Spinner and can cause unexpected results if it's
51
51
  # passing a different project than the merge request project.
@@ -89,8 +89,9 @@ module Danger
89
89
 
90
90
  private
91
91
 
92
- def teammate_pedroms
93
- @teammate_pedroms ||= Gitlab::Dangerfiles::Teammate.find_member("pedroms")
92
+ def ux_fallback_reviewer
93
+ teammates = %w[pedroms annabeldunstone seggenberger jmiocene clavimoniere]
94
+ Gitlab::Dangerfiles::Teammate.find_member(teammates.sample)
94
95
  end
95
96
 
96
97
  def spin_for_approval_rule?(rule)
@@ -62,15 +62,13 @@ module Gitlab
62
62
 
63
63
  class ImportIntegrateBE < Capability
64
64
  def has_capability?(teammate)
65
- kind == :reviewer &&
66
- teammate.role.match?(/Backend Engineer.+Manage:Import and Integrate/)
65
+ kind == :reviewer && teammate.role.match?(/Backend Engineer.+:Import and Integrate/)
67
66
  end
68
67
  end
69
68
 
70
69
  class ImportIntegrateFE < Capability
71
70
  def has_capability?(teammate)
72
- kind == :reviewer &&
73
- teammate.role.match?(/Frontend Engineer.+Manage:Import and Integrate/)
71
+ kind == :reviewer && teammate.role.match?(/Frontend Engineer.+:Import and Integrate/)
74
72
  end
75
73
  end
76
74
 
@@ -168,8 +168,8 @@ RSpec.shared_context "with teammates" do
168
168
  let(:software_engineer_in_import_integrate_fe) do
169
169
  Gitlab::Dangerfiles::Teammate.new(
170
170
  "username" => "software-engineer-in-import-and-integrate-fe",
171
- "name" => "Software Engineer in Import and Integrate FE",
172
- "role" => "Frontend Engineer, Manage:Import and Integrate",
171
+ "name" => "Frontend Engineer in Import and Integrate",
172
+ "role" => "AnyRole Frontend Engineer, AnyStage:Import and Integrate",
173
173
  "projects" => { "gitlab" => "reviewer frontend" },
174
174
  "available" => true,
175
175
  "tz_offset_hours" => 2.0
@@ -179,8 +179,8 @@ RSpec.shared_context "with teammates" do
179
179
  let(:software_engineer_in_import_integrate_be) do
180
180
  Gitlab::Dangerfiles::Teammate.new(
181
181
  "username" => "software-engineer-in-import-and-integrate-be",
182
- "name" => "Software Engineer in Import and Integrate BE",
183
- "role" => "Backend Engineer, Manage:Import and Integrate",
182
+ "name" => "Backend Engineer in Import and Integrate",
183
+ "role" => "AnyRole Backend Engineer, AnyStage:Import and Integrate",
184
184
  "projects" => { "gitlab" => "reviewer backend" },
185
185
  "available" => true,
186
186
  "tz_offset_hours" => 2.0
@@ -224,7 +224,7 @@ RSpec.shared_context "with teammates" do
224
224
  Gitlab::Dangerfiles::Teammate.new(
225
225
  "username" => "import-and-integrate-backend-reviewer",
226
226
  "name" => "Import and Integrate BE engineer",
227
- "role" => "Backend Engineer, Manage:Import and Integrate",
227
+ "role" => "AnyRole Backend Engineer, AnyStage:Import and Integrate",
228
228
  "projects" => { "gitlab" => "reviewer backend" },
229
229
  "available" => backend_reviewer_available,
230
230
  "tz_offset_hours" => 2.0
@@ -235,7 +235,7 @@ RSpec.shared_context "with teammates" do
235
235
  Gitlab::Dangerfiles::Teammate.new(
236
236
  "username" => "import-and-integrate-frontend-reviewer",
237
237
  "name" => "Import and Integrate FE engineer",
238
- "role" => "Frontend Engineer, Manage:Import and Integrate",
238
+ "role" => "AnyRole Frontend Engineer, AnyStage:Import and Integrate",
239
239
  "projects" => { "gitlab" => "reviewer frontend" },
240
240
  "available" => true,
241
241
  "tz_offset_hours" => 2.0
@@ -285,7 +285,7 @@ RSpec.shared_context "with teammates" do
285
285
  end
286
286
 
287
287
  let(:teammate_json) { teammates.to_json }
288
- let(:teammate_pedroms) { instance_double(Gitlab::Dangerfiles::Teammate, name: "Pedro") }
288
+ let(:ux_fallback_reviewer) { instance_double(Gitlab::Dangerfiles::Teammate) }
289
289
  let(:company_members) { Gitlab::Dangerfiles::Teammate.fetch_company_members }
290
290
 
291
291
  before do
@@ -18,7 +18,7 @@ module Gitlab
18
18
  @team_author = team_author
19
19
  @labels = labels
20
20
  @categories = categories.reject do |category|
21
- import_and_integrate_reject_category?(category)
21
+ import_and_integrate_reject_category?(project, category, labels)
22
22
  end
23
23
  @random = random
24
24
  @ux_fallback_wider_community_reviewer = ux_fallback_wider_community_reviewer
@@ -98,12 +98,13 @@ module Gitlab
98
98
 
99
99
  attr_reader :random, :ux_fallback_wider_community_reviewer
100
100
 
101
+ # Reject Import and Integrate categories if the MR author has reviewing abilities for the category.
102
+ #
101
103
  # @param [String] category name
102
104
  # @return [Boolean]
103
- def import_and_integrate_reject_category?(category)
104
- # Reject Import and Integrate categories if the MR author has reviewing abilities for the category.
105
- team_author&.import_integrate_be?(project, category, labels) ||
106
- team_author&.import_integrate_fe?(project, category, labels)
105
+ def import_and_integrate_reject_category?(project, category, labels)
106
+ [:import_integrate_be, :import_integrate_fe].include?(category) && team_author &&
107
+ (team_author.reviewer?(project, category, labels) || team_author.maintainer?(project, category, labels))
107
108
  end
108
109
 
109
110
  # MR includes QA changes, but also other changes, and author isn't an SET
@@ -141,18 +141,6 @@ module Gitlab
141
141
  has_capability?(project, category, :maintainer, labels)
142
142
  end
143
143
 
144
- def import_integrate_be?(project, category, labels)
145
- return false unless category == :import_integrate_be
146
-
147
- has_capability?(project, category, :reviewer, labels)
148
- end
149
-
150
- def import_integrate_fe?(project, category, labels)
151
- return false unless category == :import_integrate_fe
152
-
153
- has_capability?(project, category, :reviewer, labels)
154
- end
155
-
156
144
  def markdown_name(author: nil)
157
145
  "#{@markdown_name}#{utc_offset_text(author)}"
158
146
  end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "4.9.0"
3
+ VERSION = "4.9.1"
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: 4.9.0
4
+ version: 4.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-28 00:00:00.000000000 Z
11
+ date: 2025-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.8'
139
+ - !ruby/object:Gem::Dependency
140
+ name: racc
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '1.8'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '1.8'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rubocop-rails
141
155
  requirement: !ruby/object:Gem::Requirement