gitlab-dangerfiles 3.12.0 → 4.0.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 +4 -4
- data/.gitlab-ci.yml +0 -6
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +0 -8
- data/README.md +1 -11
- data/gitlab-dangerfiles.gemspec +1 -1
- data/lib/danger/plugins/changelog.rb +1 -3
- data/lib/danger/plugins/internal/helper.rb +1 -0
- data/lib/danger/plugins/roulette.rb +11 -20
- data/lib/danger/rules/simple_roulette/Dangerfile +0 -4
- data/lib/danger/rules/type_label/Dangerfile +0 -8
- data/lib/gitlab/dangerfiles/category.rb +7 -15
- data/lib/gitlab/dangerfiles/type_label_guesser.rb +2 -2
- data/lib/gitlab/dangerfiles/version.rb +1 -1
- data/lib/gitlab/dangerfiles.rb +0 -1
- metadata +4 -5
- data/lib/danger/rules/subtype_label/Dangerfile +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c54d1dcf5be1bc4fb1b1f187ba1b203ddef74f661120b9efe9834ee05e95fee8
|
4
|
+
data.tar.gz: ac3617187d9bf2d523324b4320619fb361e30690ac2644e00e6a3edbaf78090c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1b739e770be63ced18c8abd0a6f1be161bf62a98b86673fe88b95db79b589c57a0431174e43f4acf77e884e4bb8dc40272f17a6cb60282925062d1741f1d573
|
7
|
+
data.tar.gz: e6be44372b6881090c3e9a9d0099405315661c73a84a59ba7848b31f10ed4f72e3e861784fdfff47c985b192d26169ee96378d0d96487494c5d59ddd0e044d18
|
data/.gitlab-ci.yml
CHANGED
@@ -57,7 +57,6 @@ test:rufo:
|
|
57
57
|
|
58
58
|
include:
|
59
59
|
- template: Security/Dependency-Scanning.gitlab-ci.yml
|
60
|
-
- template: Security/License-Scanning.gitlab-ci.yml
|
61
60
|
- template: Security/SAST.gitlab-ci.yml
|
62
61
|
- template: Security/Secret-Detection.gitlab-ci.yml
|
63
62
|
- project: 'gitlab-org/quality/pipeline-common'
|
@@ -78,11 +77,6 @@ gemnasium-dependency_scanning:
|
|
78
77
|
- if: '$CI_MERGE_REQUEST_IID'
|
79
78
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
80
79
|
|
81
|
-
license_scanning:
|
82
|
-
rules:
|
83
|
-
- if: '$CI_MERGE_REQUEST_IID'
|
84
|
-
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
85
|
-
|
86
80
|
secret_detection:
|
87
81
|
rules:
|
88
82
|
- if: '$CI_MERGE_REQUEST_IID'
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -126,11 +126,6 @@ Lint/IdentityComparison:
|
|
126
126
|
- 'spec/gitlab/dangerfiles/weightage/maintainers_spec.rb'
|
127
127
|
- 'spec/gitlab/dangerfiles/weightage/reviewers_spec.rb'
|
128
128
|
|
129
|
-
# Offense count: 1
|
130
|
-
Lint/NonLocalExitFromIterator:
|
131
|
-
Exclude:
|
132
|
-
- 'lib/danger/rules/subtype_label/Dangerfile'
|
133
|
-
|
134
129
|
# Offense count: 1
|
135
130
|
# This cop supports safe autocorrection (--autocorrect).
|
136
131
|
Lint/RedundantCopDisableDirective:
|
@@ -310,7 +305,6 @@ Style/FrozenStringLiteralComment:
|
|
310
305
|
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
311
306
|
Style/GuardClause:
|
312
307
|
Exclude:
|
313
|
-
- 'lib/danger/rules/subtype_label/Dangerfile'
|
314
308
|
- 'lib/danger/rules/type_label/Dangerfile'
|
315
309
|
|
316
310
|
# Offense count: 2
|
@@ -384,7 +378,6 @@ Style/PercentLiteralDelimiters:
|
|
384
378
|
- 'Guardfile'
|
385
379
|
- 'gitlab-dangerfiles.gemspec'
|
386
380
|
- 'lib/danger/plugins/internal/helper.rb'
|
387
|
-
- 'lib/danger/rules/subtype_label/Dangerfile'
|
388
381
|
- 'lib/gitlab/dangerfiles/tasks/main.rake'
|
389
382
|
- 'spec/danger/plugins/internal/helper_spec.rb'
|
390
383
|
|
@@ -471,7 +464,6 @@ Style/SelectByRegexp:
|
|
471
464
|
# SupportedStyles: only_raise, only_fail, semantic
|
472
465
|
Style/SignalException:
|
473
466
|
Exclude:
|
474
|
-
- 'lib/danger/rules/subtype_label/Dangerfile'
|
475
467
|
- 'lib/danger/rules/type_label/Dangerfile'
|
476
468
|
|
477
469
|
# Offense count: 7
|
data/README.md
CHANGED
@@ -148,19 +148,9 @@ project. To use it in your project, perform the following steps:
|
|
148
148
|
end
|
149
149
|
```
|
150
150
|
|
151
|
-
#### `subtype_label`
|
152
|
-
|
153
|
-
This rule warns when the merge request is missing a [subtype label](https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification).
|
154
|
-
|
155
|
-
If the `DANGER_ERROR_WHEN_SUBTYPE_LABEL_IS_MISSING` environment variable evaluates to `true`, Danger will error instead of warning when a subtype label is missing.
|
156
|
-
|
157
151
|
#### `type_label`
|
158
152
|
|
159
|
-
|
160
|
-
|
161
|
-
If the `DANGER_ERROR_WHEN_TYPE_LABEL_IS_MISSING` environment variable evaluates to `true`, Danger will error instead of warning when a type label is missing.
|
162
|
-
|
163
|
-
If the `changelog` plugin is available, it also tries to infer a type label from the `Changelog` trailer of the MR.
|
153
|
+
If the `changelog` plugin is available, it tries to infer a type label from the `Changelog` trailer of the MR.
|
164
154
|
|
165
155
|
#### `z_add_labels`
|
166
156
|
|
data/gitlab-dangerfiles.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_dependency "rake", ">= 0"
|
31
31
|
spec.add_dependency "danger-gitlab", ">= 8.0.0"
|
32
|
-
spec.add_dependency "danger", ">=
|
32
|
+
spec.add_dependency "danger", ">= 9.3.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
35
35
|
spec.add_development_dependency "rspec-parameterized"
|
@@ -24,9 +24,7 @@ module Danger
|
|
24
24
|
OPTIONAL_CHANGELOG_MESSAGE = {
|
25
25
|
local: "If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message.",
|
26
26
|
ci: <<~MSG,
|
27
|
-
If
|
28
|
-
|
29
|
-
If you want to create a changelog entry for GitLab EE, also [add the `EE: true` trailer](https://docs.gitlab.com/ee/development/changelog.html#gitlab-enterprise-changes) to your commit message.
|
27
|
+
If this merge request needs a changelog entry, add the `Changelog` trailer to the commit message you want to add to the changelog.
|
30
28
|
|
31
29
|
If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message.
|
32
30
|
MSG
|
@@ -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
|
-
|
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
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
TYPE_LABEL_MISSING_MESSAGE = "Please add a [merge request type](https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification) to this merge request."
|
4
|
-
|
5
3
|
require_relative "../../../gitlab/dangerfiles/type_label_guesser"
|
6
4
|
|
7
5
|
return if helper.has_scoped_label_with_scope?("type")
|
@@ -10,9 +8,3 @@ if respond_to?(:changelog)
|
|
10
8
|
type_label_guesser = Gitlab::Dangerfiles::TypeLabelGuesser.new
|
11
9
|
helper.labels_to_add.concat(type_label_guesser.labels_from_changelog_categories(changelog.categories))
|
12
10
|
end
|
13
|
-
|
14
|
-
if ENV['DANGER_ERROR_WHEN_TYPE_LABEL_IS_MISSING'] == 'true'
|
15
|
-
fail TYPE_LABEL_MISSING_MESSAGE
|
16
|
-
else
|
17
|
-
warn TYPE_LABEL_MISSING_MESSAGE
|
18
|
-
end
|
@@ -78,27 +78,19 @@ module Gitlab
|
|
78
78
|
super &&
|
79
79
|
|
80
80
|
if labels.any?("Community contribution")
|
81
|
-
|
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
|
-
|
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:
|
@@ -8,8 +8,8 @@ module Gitlab
|
|
8
8
|
security: %w[type::bug bug::vulnerability],
|
9
9
|
performance: %w[type::bug bug::performance],
|
10
10
|
added: %w[type::feature feature::addition],
|
11
|
-
deprecated: %w[type::
|
12
|
-
removed: %w[type::
|
11
|
+
deprecated: %w[type::maintenance maintenance::removal],
|
12
|
+
removed: %w[type::maintenance maintenance::removal],
|
13
13
|
}.freeze
|
14
14
|
|
15
15
|
def labels_from_changelog_categories(categories)
|
data/lib/gitlab/dangerfiles.rb
CHANGED
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
|
+
version: 4.0.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-
|
11
|
+
date: 2023-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 9.3.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 9.3.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,7 +176,6 @@ files:
|
|
176
176
|
- lib/danger/rules/commits_counter/Dangerfile
|
177
177
|
- lib/danger/rules/metadata/Dangerfile
|
178
178
|
- lib/danger/rules/simple_roulette/Dangerfile
|
179
|
-
- lib/danger/rules/subtype_label/Dangerfile
|
180
179
|
- lib/danger/rules/type_label/Dangerfile
|
181
180
|
- lib/danger/rules/z_add_labels/Dangerfile
|
182
181
|
- lib/danger/rules/z_retry_link/Dangerfile
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
SUBTYPE_LABEL_MISSING_MESSAGE = "Please add a [merge request subtype](https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification) to this merge request."
|
4
|
-
|
5
|
-
types = %w(bug feature maintenance)
|
6
|
-
types.each do |type|
|
7
|
-
return if helper.has_scoped_label_with_scope?(type)
|
8
|
-
end
|
9
|
-
|
10
|
-
if ENV['DANGER_ERROR_WHEN_SUBTYPE_LABEL_IS_MISSING'] == 'true'
|
11
|
-
fail SUBTYPE_LABEL_MISSING_MESSAGE
|
12
|
-
else
|
13
|
-
warn SUBTYPE_LABEL_MISSING_MESSAGE
|
14
|
-
end
|