gitlab-dangerfiles 3.1.0 → 3.2.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: b25f2e8617ff29a3ea964b59774b02c395127c4800bfa1552affd2e71bf62a89
|
4
|
+
data.tar.gz: 813ca1c6dbd433cd43f1f5ef0efc44a514af3edf7cf7ed07d75eea50640817da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5208cc7b7c588c5fe7403f3b79631313a71c64007ed572fe8a5848a1c229f59f9e653f0b263c5c73efc85a1339fda852d2f44f376cca19f2d2ecac8e406b111
|
7
|
+
data.tar.gz: 4b31682875c0c7f5037463d035a57cb9ccd4215d68879105ce4a369539d1e155b6da7b620f942611d9d0fc92251bf58338614230bd16008dbd715974ffee57d9
|
data/README.md
CHANGED
@@ -172,6 +172,31 @@ include:
|
|
172
172
|
|
173
173
|
See a [real world example](https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/105).
|
174
174
|
|
175
|
+
#### Without `Gemfile`
|
176
|
+
|
177
|
+
Danger is a Ruby project and uses [`bundler`](https://bundler.io/) to manage
|
178
|
+
its dependencies. This requires a project to have a `Gemfile` and
|
179
|
+
`Gemfile.lock` commited. This is helpful especially if Danger is also used
|
180
|
+
locally - with `lefthook`, for example.
|
181
|
+
|
182
|
+
In order to skip Ruby and `bundler` dependency in a project, use `bundle` commands directly
|
183
|
+
in the CI configuration:
|
184
|
+
|
185
|
+
```yaml
|
186
|
+
include:
|
187
|
+
- project: 'gitlab-org/quality/pipeline-common'
|
188
|
+
file: '/ci/danger-review.yml'
|
189
|
+
|
190
|
+
danger-review:
|
191
|
+
before_script:
|
192
|
+
- bundle init
|
193
|
+
# For latest version
|
194
|
+
- bundle add gitlab-dangerfiles
|
195
|
+
# OR
|
196
|
+
# For a pinned version
|
197
|
+
- bundle add gitlab-dangerfiles --version 3.1.0
|
198
|
+
```
|
199
|
+
|
175
200
|
## Rake tasks
|
176
201
|
|
177
202
|
You can import this gem's Rake tasks by adding the following to your project's `Rakefile`:
|
@@ -192,7 +217,9 @@ Latest documentation can be found at <https://www.rubydoc.info/gems/gitlab-dange
|
|
192
217
|
|
193
218
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
194
219
|
|
195
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
220
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
221
|
+
|
222
|
+
To release a new version, update the version number in `version.rb`, and get the MR merged by a maintainer. This will be then be packaged into a gem and pushed to [rubygems.org](https://rubygems.org) by the CI/CD.
|
196
223
|
|
197
224
|
## Contributing
|
198
225
|
|
@@ -17,7 +17,7 @@ module Danger
|
|
17
17
|
none: "",
|
18
18
|
qa: "~QA",
|
19
19
|
ux: "~UX",
|
20
|
-
test: "~test
|
20
|
+
test: "~test for `spec/features/*`",
|
21
21
|
# Deprecated as of 2.3.0 in favor of tooling
|
22
22
|
engineering_productivity: '~"Engineering Productivity" for CI, Danger',
|
23
23
|
tooling: '~"maintenance::workflow" / ~"maintenance::pipelines" for CI, Danger',
|
@@ -13,15 +13,15 @@ module Gitlab
|
|
13
13
|
# | reduced capacity reviewer | 1 |
|
14
14
|
# | reviewer | 2 |
|
15
15
|
# | hungry reviewer | 4 |
|
16
|
-
# | reduced capacity traintainer |
|
17
|
-
# | traintainer |
|
18
|
-
# | hungry traintainer |
|
16
|
+
# | reduced capacity traintainer | 1 |
|
17
|
+
# | traintainer | 2 |
|
18
|
+
# | hungry traintainer | 6 |
|
19
19
|
# +------------------------------+--------------------------------+
|
20
20
|
#
|
21
21
|
# @api private
|
22
22
|
class Reviewers
|
23
23
|
DEFAULT_REVIEWER_WEIGHT = Gitlab::Dangerfiles::Weightage::CAPACITY_MULTIPLIER * Gitlab::Dangerfiles::Weightage::BASE_REVIEWER_WEIGHT
|
24
|
-
TRAINTAINER_WEIGHT =
|
24
|
+
TRAINTAINER_WEIGHT = 2
|
25
25
|
|
26
26
|
def initialize(reviewers, traintainers)
|
27
27
|
@reviewers = reviewers
|
@@ -32,6 +32,8 @@ module Gitlab
|
|
32
32
|
# TODO: take CODEOWNERS into account?
|
33
33
|
# https://gitlab.com/gitlab-org/gitlab/issues/26723
|
34
34
|
|
35
|
+
remove_traintainers_from_reviewers!
|
36
|
+
|
35
37
|
weighted_reviewers + weighted_traintainers
|
36
38
|
end
|
37
39
|
|
@@ -39,25 +41,33 @@ module Gitlab
|
|
39
41
|
|
40
42
|
attr_reader :reviewers, :traintainers
|
41
43
|
|
44
|
+
def remove_traintainers_from_reviewers!
|
45
|
+
# Sometimes folks will add themselves as traintainers and not remove themselves as reviewers.
|
46
|
+
# There seems no way currently to ensure only one of these entries exists for a person.
|
47
|
+
# We need to protect ourselves from that scenario here as the code assumes a reviewer will only
|
48
|
+
# appear in reviewers or traintainers, not both.
|
49
|
+
reviewers.reject! { |reviewer| traintainers.include?(reviewer) }
|
50
|
+
end
|
51
|
+
|
42
52
|
def weighted_reviewers
|
43
53
|
reviewers.each_with_object([]) do |reviewer, total_reviewers|
|
44
|
-
add_weighted_reviewer(total_reviewers, reviewer,
|
54
|
+
add_weighted_reviewer(total_reviewers, reviewer, DEFAULT_REVIEWER_WEIGHT)
|
45
55
|
end
|
46
56
|
end
|
47
57
|
|
48
58
|
def weighted_traintainers
|
49
59
|
traintainers.each_with_object([]) do |reviewer, total_traintainers|
|
50
|
-
add_weighted_reviewer(total_traintainers, reviewer, TRAINTAINER_WEIGHT)
|
60
|
+
add_weighted_reviewer(total_traintainers, reviewer, DEFAULT_REVIEWER_WEIGHT + TRAINTAINER_WEIGHT)
|
51
61
|
end
|
52
62
|
end
|
53
63
|
|
54
|
-
def add_weighted_reviewer(reviewers, reviewer,
|
64
|
+
def add_weighted_reviewer(reviewers, reviewer, added_weight_for_hungry)
|
55
65
|
if reviewer.reduced_capacity
|
56
|
-
reviewers.fill(reviewer, reviewers.size,
|
66
|
+
reviewers.fill(reviewer, reviewers.size, Gitlab::Dangerfiles::Weightage::BASE_REVIEWER_WEIGHT)
|
57
67
|
elsif reviewer.hungry
|
58
|
-
reviewers.fill(reviewer, reviewers.size,
|
68
|
+
reviewers.fill(reviewer, reviewers.size, DEFAULT_REVIEWER_WEIGHT + added_weight_for_hungry)
|
59
69
|
else
|
60
|
-
reviewers.fill(reviewer, reviewers.size,
|
70
|
+
reviewers.fill(reviewer, reviewers.size, DEFAULT_REVIEWER_WEIGHT)
|
61
71
|
end
|
62
72
|
end
|
63
73
|
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.
|
4
|
+
version: 3.2.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-
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -169,6 +169,7 @@ files:
|
|
169
169
|
- lib/danger/rules/changelog/Dangerfile
|
170
170
|
- lib/danger/rules/changes_size/Dangerfile
|
171
171
|
- lib/danger/rules/commit_messages/Dangerfile
|
172
|
+
- lib/danger/rules/commits_counter/Dangerfile
|
172
173
|
- lib/danger/rules/simple_roulette/Dangerfile
|
173
174
|
- lib/danger/rules/type_label/Dangerfile
|
174
175
|
- lib/danger/rules/z_add_labels/Dangerfile
|