gitlab-dangerfiles 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf965c37aaf01dff0630442feecb4fbe6e8d96bb2c9f7f714c631487c9eb894e
|
4
|
+
data.tar.gz: 720fe1ddfd202e0b199dfbd63fdb360a8a7e58d355182b7055ff0fdebb74c886
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31a832aa516290296662a7949b01a13c7dd47e7c05ad6c6e78cb1f189f2190b99094e97a07875d65f4cb6b5504a8816d1a26aa39a618480899f2026c58c2c311
|
7
|
+
data.tar.gz: 4f18f92c83494aff49ceec1a05f2b380bd9be7aee17a50a4126ec25c011cfc468a672da200d4a93420d4c47bbec19d6678dc389e083a56945d94d52a58862107
|
@@ -192,7 +192,10 @@ module Danger
|
|
192
192
|
#
|
193
193
|
# @return [Array<Gitlab::Dangerfiles::Teammate>]
|
194
194
|
def project_team(project_name)
|
195
|
-
company_members.select
|
195
|
+
company_members.select do |member|
|
196
|
+
member.in_project?(project_name) ||
|
197
|
+
member.in_project?("gitlab") # Used for backup reviewer
|
198
|
+
end
|
196
199
|
rescue => err
|
197
200
|
warn("Reviewer roulette failed to load team data: #{err.message}")
|
198
201
|
[]
|
@@ -60,37 +60,44 @@ def note_for_spin_role(spin, role)
|
|
60
60
|
spin.public_send(role)&.markdown_name(author: roulette.team_mr_author)
|
61
61
|
end
|
62
62
|
|
63
|
-
def markdown_row_for_spins(category = nil, spins_array)
|
63
|
+
def markdown_row_for_spins(category = nil, spins_array, has_categories:)
|
64
64
|
reviewer_note = note_for_spins_role(spins_array, :reviewer)
|
65
65
|
maintainer_note = note_for_spins_role(spins_array, :maintainer)
|
66
66
|
|
67
67
|
row = +"| #{reviewer_note} | #{maintainer_note} |"
|
68
|
-
row.prepend("| #{helper.label_for_category(category)} ") if
|
69
|
-
|
68
|
+
row.prepend("| #{helper.label_for_category(category)} ") if has_categories
|
70
69
|
row
|
71
70
|
end
|
72
71
|
|
73
|
-
|
74
|
-
helper.config.files_to_category.any?
|
75
|
-
end
|
72
|
+
changes = helper.changes_by_category
|
76
73
|
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
# Replicating label based categories from:
|
75
|
+
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/danger/roulette/Dangerfile
|
76
|
+
categories = Set.new(changes.keys - [:unknown])
|
80
77
|
|
81
|
-
|
82
|
-
|
83
|
-
end
|
78
|
+
# Ensure to spin for database reviewer/maintainer when ~database is applied (e.g. to review SQL queries)
|
79
|
+
categories << :database if helper.mr_labels.include?('database')
|
84
80
|
|
85
|
-
changes
|
81
|
+
# Ensure to spin for UX reviewer when ~UX is applied (e.g. to review changes to the UI) except when it's from wider community contribution where we want to assign from the corresponding group
|
82
|
+
categories << :ux if helper.mr_labels.include?('UX') && !helper.mr_labels.include?('Community contribution')
|
83
|
+
|
84
|
+
# Ensure to spin for Product Intelligence reviewer when ~"product intelligence::review pending" is applied
|
85
|
+
categories << :product_intelligence if helper.mr_labels.include?("product intelligence::review pending")
|
86
|
+
|
87
|
+
# Skip Product intelligence reviews for growth experiment MRs
|
88
|
+
categories.delete(:product_intelligence) if helper.mr_labels.include?("growth experiment")
|
86
89
|
|
87
90
|
if changes.any?
|
88
|
-
|
91
|
+
has_categories = categories.any?
|
92
|
+
categories = [nil] unless has_categories
|
93
|
+
random_roulette_spins = roulette.spin(nil, categories)
|
89
94
|
|
90
95
|
rows = random_roulette_spins.map do |spin|
|
91
|
-
markdown_row_for_spins(spin.category, [spin])
|
96
|
+
markdown_row_for_spins(spin.category, [spin], has_categories: has_categories)
|
92
97
|
end
|
93
98
|
|
99
|
+
table_header = has_categories ? TABLE_HEADER_WITH_CATEGORIES : TABLE_HEADER_WITHOUT_CATEGORIES
|
100
|
+
|
94
101
|
markdown(MESSAGE)
|
95
102
|
markdown(TABLE_MARKDOWN + table_header + rows.join("\n")) unless rows.empty?
|
96
103
|
end
|
@@ -130,11 +130,22 @@ module Gitlab
|
|
130
130
|
capabilities(project).include?("#{kind}")
|
131
131
|
else
|
132
132
|
capabilities(project).include?("#{kind} #{category}")
|
133
|
+
end || has_backup_capability?(category, kind, labels)
|
134
|
+
end
|
135
|
+
|
136
|
+
def has_backup_capability?(category, kind, labels)
|
137
|
+
case category
|
138
|
+
when :ux
|
139
|
+
capacity = "#{kind} #{category}"
|
140
|
+
|
141
|
+
projects.each_value.find do |capabilities|
|
142
|
+
capabilities.include?(capacity)
|
143
|
+
end
|
133
144
|
end
|
134
145
|
end
|
135
146
|
|
136
147
|
def capabilities(project)
|
137
|
-
|
148
|
+
projects.fetch(project, [])
|
138
149
|
end
|
139
150
|
|
140
151
|
def pluralize(count, singular, plural)
|
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.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|