gitlab-dangerfiles 3.6.2 → 3.6.4

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: 5c9ef239b79432bbb3b87cd49450338435f8ea5e0d27ed4beff1c2ce019dc79a
4
- data.tar.gz: f5b42d80cba45edaba0bbda8fbbb314546489743e16ec74b7ab28dfc89bd4acb
3
+ metadata.gz: 34ff9782c4b20cd3c7dbb4a25d7ecdf66cf49ef303e1deb0bb04074e1c4fca21
4
+ data.tar.gz: b21f8643147b7147fca7e5cba536c67bf98d65f827cb169d72fd2ac5ff3de355
5
5
  SHA512:
6
- metadata.gz: 3dc38989aa7959bac78ec9bcd36fa7ddfcd0c265b6a049c8ac37d5163bf8834e930e317368402d53850a8a12161bdf8f38cb1309068c27319f34c9a5b7c85d06
7
- data.tar.gz: 779f8c6c3f1b817b88813010048d1541609fca1e92bd3021abf4f8b18f46fffcbee8ed239a48d78254a6858925d56b62ddf202b3f8c361b62f4ffcc57476fc51
6
+ metadata.gz: 7f9f43daf58a905f330ad98020327073a47692f24c0494d407d7e76aa8b18819b74839772c58b19d9081b04034154a06e8dee588c70898b71db08bab03fa31a9
7
+ data.tar.gz: f30572b11ac8e2d9a4ab9cc35c19000c68ecdaefd72f8e276f18e73da3beeb64b81a44d2e4919977c0aabecafec5d3fa64a25443604c27168865a5acb7c6bf97
data/README.md CHANGED
@@ -128,8 +128,12 @@ project. To use it in your project, perform the following steps:
128
128
  see how to set it up.
129
129
  1. When using the default roulette, use `import_defaults` or import it manually when setting
130
130
  up the gitlab-dangerfiles instance:
131
+
131
132
  ```ruby
133
+ require 'gitlab-dangerfiles'
134
+
132
135
  Gitlab::Dangerfiles.for_project(self) do |dangerfiles|
136
+ dangerfiles.import_plugins
133
137
  dangerfiles.import_dangerfiles(only: %w[simple_roulette])
134
138
  end
135
139
  ```
@@ -17,6 +17,7 @@ module Danger
17
17
  none: "",
18
18
  qa: "~QA",
19
19
  ux: "~UX",
20
+ codeowners: '~"Code Owners"',
20
21
  test: "~test for `spec/features/*`",
21
22
  # Deprecated as of 2.3.0 in favor of tooling
22
23
  engineering_productivity: '~"Engineering Productivity" for CI, Danger',
@@ -235,7 +236,13 @@ module Danger
235
236
  # @return [String] the GFM for a category label, making its best guess if it's not
236
237
  # a category we know about.
237
238
  def label_for_category(category)
238
- CATEGORY_LABELS.fetch(category, %Q{~"#{category}"})
239
+ CATEGORY_LABELS[category] ||
240
+
241
+ if category.start_with?("`")
242
+ category.to_s
243
+ else
244
+ %Q{~"#{category}"}
245
+ end
239
246
  end
240
247
 
241
248
  # @return [String] +""+ when not in the CI context, and the MR Source Project ID as a string otherwise.
@@ -20,7 +20,13 @@ module Danger
20
20
 
21
21
  Approval = Struct.new(:category, :spin) do
22
22
  def self.from_approval_rule(rule, maintainer)
23
- category = rule["section"].to_sym
23
+ category =
24
+ if rule["section"] == "codeowners"
25
+ "`#{rule["name"]}`"
26
+ else
27
+ rule["section"]
28
+ end.to_sym
29
+
24
30
  spin = Spin.new(category, nil, maintainer, :reviewer)
25
31
 
26
32
  new(category, spin)
@@ -5,7 +5,8 @@ require_relative "category"
5
5
  module Gitlab
6
6
  module Dangerfiles
7
7
  class Teammate
8
- attr_reader :options, :username, :name, :role, :projects, :available, :hungry, :reduced_capacity, :tz_offset_hours
8
+ attr_reader :options, :username, :name, :role, :projects, :available, :hungry, :reduced_capacity, :tz_offset_hours,
9
+ :only_maintainer_reviews
9
10
 
10
11
  # The options data are produced by https://gitlab.com/gitlab-org/gitlab-roulette/-/blob/master/lib/team_member.rb
11
12
  def initialize(options = {})
@@ -20,6 +21,7 @@ module Gitlab
20
21
  @hungry = options["hungry"]
21
22
  @reduced_capacity = options["reduced_capacity"]
22
23
  @tz_offset_hours = options["tz_offset_hours"]
24
+ @only_maintainer_reviews = options["only_maintainer_reviews"]
23
25
  end
24
26
 
25
27
  def to_h
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "3.6.2"
3
+ VERSION = "3.6.4"
4
4
  end
5
5
  end
@@ -33,6 +33,7 @@ module Gitlab
33
33
  # https://gitlab.com/gitlab-org/gitlab/issues/26723
34
34
 
35
35
  remove_traintainers_from_reviewers!
36
+ remove_maintainer_only_from_reviewers!
36
37
 
37
38
  weighted_reviewers + weighted_traintainers
38
39
  end
@@ -49,6 +50,11 @@ module Gitlab
49
50
  reviewers.reject! { |reviewer| traintainers.include?(reviewer) }
50
51
  end
51
52
 
53
+ def remove_maintainer_only_from_reviewers!
54
+ # Using a maintainer-only reviewer emoji, team members can ensure they only get maintainer reviews
55
+ reviewers.reject! { |reviewer| reviewer&.only_maintainer_reviews }
56
+ end
57
+
52
58
  def weighted_reviewers
53
59
  reviewers.each_with_object([]) do |reviewer, total_reviewers|
54
60
  add_weighted_reviewer(total_reviewers, reviewer, DEFAULT_REVIEWER_WEIGHT)
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.6.2
4
+ version: 3.6.4
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-04 00:00:00.000000000 Z
11
+ date: 2022-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake