gitlab-dangerfiles 2.2.2 → 2.4.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/README.md +3 -2
- data/lib/danger/plugins/helper.rb +5 -1
- data/lib/danger/plugins/roulette.rb +3 -1
- data/lib/gitlab/dangerfiles/base_linter.rb +4 -0
- data/lib/gitlab/dangerfiles/commit_linter.rb +9 -4
- data/lib/gitlab/dangerfiles/teammate.rb +19 -1
- data/lib/gitlab/dangerfiles/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 635a5f7c76e99281a75a956cc045c25b11e0ba243dca544dfeff4c53c6665826
|
4
|
+
data.tar.gz: baf2cd3b0d5bc499f980ac031c816dbdfe656e099af9db4520ad0a282788b1c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8db37fdb8728b021e63c60cf612255894d353224274010ae5ccaf7b110968c5735fbc8ec7bf936c320d6b1c0c5413ab5bd9eb925571035b824d06b6c95cd3a0f
|
7
|
+
data.tar.gz: 1c3a3d119b6be0a19d2648740038d33e1dcba3ed0821dec6c4b4be988983a8d7a45818b33c3510168a924b47950151fc0906f10887f6ac1f21388fad62bd43cb
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ The goal of this gem is to centralize Danger plugins and rules that to be used b
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'gitlab-dangerfiles'
|
10
|
+
gem 'gitlab-dangerfiles', require: false
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -29,6 +29,8 @@ $ gem install gitlab-dangerfiles
|
|
29
29
|
In your project's `Dangerfile`, add the following two line to import the plugins and rules from this gem:
|
30
30
|
|
31
31
|
```ruby
|
32
|
+
require 'gitlab-dangerfiles'
|
33
|
+
|
32
34
|
# Get an instance of Gitlab::Dangerfiles
|
33
35
|
gitlab_dangerfiles = Gitlab::Dangerfiles::Engine.new(self)
|
34
36
|
|
@@ -53,7 +55,6 @@ For the full documentation about the plugins, please see https://www.rubydoc.inf
|
|
53
55
|
|
54
56
|
### Rules
|
55
57
|
|
56
|
-
|
57
58
|
Danger rules are located under `lib/danger/rules`.
|
58
59
|
|
59
60
|
#### `changes_size`
|
@@ -17,9 +17,13 @@ module Danger
|
|
17
17
|
none: "",
|
18
18
|
qa: "~QA",
|
19
19
|
test: "~test ~Quality for `spec/features/*`",
|
20
|
+
# Deprecated as of 2.3.0 in favor of tooling
|
20
21
|
engineering_productivity: '~"Engineering Productivity" for CI, Danger',
|
22
|
+
tooling: '~"type::tooling" for CI, Danger',
|
21
23
|
ci_template: '~"ci::templates"',
|
22
24
|
product_intelligence: '~"product intelligence"',
|
25
|
+
integrations_be: '~"group::integrations" (backend)',
|
26
|
+
integrations_fe: '~"group::integrations" (frontend)',
|
23
27
|
}.freeze
|
24
28
|
|
25
29
|
# Allows to set specific rule's configuration by passing a block.
|
@@ -211,7 +215,7 @@ module Danger
|
|
211
215
|
# +filename_regex+ is the regex pattern to match file names. +changes_regex+ is the regex pattern to
|
212
216
|
# match changed lines in files that match +filename_regex+
|
213
217
|
#
|
214
|
-
# @return [Array<Symbol>] the categories a file is in, e.g., +[:frontend]+, +[:backend]+, or +%i[frontend
|
218
|
+
# @return [Array<Symbol>] the categories a file is in, e.g., +[:frontend]+, +[:backend]+, or +%i[frontend tooling]+
|
215
219
|
# using filename regex (+filename_regex+) and specific change regex (+changes_regex+) from the given +categories+ hash.
|
216
220
|
def categories_for_file(filename, categories)
|
217
221
|
_, categories = categories.find do |key, _|
|
@@ -58,7 +58,7 @@ module Danger
|
|
58
58
|
# Fetch an already picked backend reviewer, or pick one otherwise
|
59
59
|
spin.reviewer = backend_spin&.reviewer || spin_for_category(project, :backend, timezone_experiment: including_timezone).reviewer
|
60
60
|
end
|
61
|
-
when :engineering_productivity
|
61
|
+
when :tooling, :engineering_productivity # Deprecated as of 2.3.0 in favor of tooling
|
62
62
|
if spin.maintainer.nil?
|
63
63
|
# Fetch an already picked backend maintainer, or pick one otherwise
|
64
64
|
spin.maintainer = backend_spin&.maintainer || spin_for_category(project, :backend, timezone_experiment: including_timezone).maintainer
|
@@ -75,6 +75,8 @@ module Danger
|
|
75
75
|
# Fetch an already picked maintainer, or pick one otherwise
|
76
76
|
spin.maintainer = backend_spin&.maintainer || frontend_spin&.maintainer || spin_for_category(project, :backend, timezone_experiment: including_timezone).maintainer
|
77
77
|
end
|
78
|
+
when :integrations_be, :integrations_fe
|
79
|
+
spin.optional_role = :maintainer
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
@@ -9,9 +9,9 @@ module Gitlab
|
|
9
9
|
MAX_CHANGED_FILES_IN_COMMIT = 3
|
10
10
|
MAX_CHANGED_LINES_IN_COMMIT = 30
|
11
11
|
# Issue, MR, Epic
|
12
|
-
SHORT_REFERENCE_REGEX = %r{([\w\-\/]+)?(?<!`)(#|!|&)\d+(?<!`)}.freeze
|
12
|
+
SHORT_REFERENCE_REGEX = %r{(\S*([\w\-\/]+)?(?<!`)(#|!|&)\d+(?<!`))}.freeze
|
13
13
|
# Milestone
|
14
|
-
MS_SHORT_REFERENCE_REGEX = %r{([\w\-\/]+)?(?<!`)%"?\d{1,3}\.\d{1,3}"?(?<!`)}.freeze
|
14
|
+
MS_SHORT_REFERENCE_REGEX = %r{(\S*([\w\-\/]+)?(?<!`)%"?\d{1,3}\.\d{1,3}"?(?<!`))}.freeze
|
15
15
|
SUGGESTIONS_APPLIED_COMMIT_REGEX = /Apply \d+ suggestion\(s\) to \d+ file\(s\)/.freeze
|
16
16
|
|
17
17
|
def self.problems_mapping
|
@@ -143,8 +143,13 @@ module Gitlab
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def message_contains_short_reference?
|
146
|
-
commit.message.match
|
147
|
-
|
146
|
+
match_data = commit.message.match(SHORT_REFERENCE_REGEX) ||
|
147
|
+
commit.message.match(MS_SHORT_REFERENCE_REGEX)
|
148
|
+
|
149
|
+
return false unless match_data
|
150
|
+
|
151
|
+
# Any URL would include "//". This works for http/https/ftp etc.
|
152
|
+
!match_data[1].include?("//")
|
148
153
|
end
|
149
154
|
|
150
155
|
def emoji_checker
|
@@ -49,6 +49,18 @@ module Gitlab
|
|
49
49
|
has_capability?(project, category, :maintainer, labels)
|
50
50
|
end
|
51
51
|
|
52
|
+
def integrations_be?(project, category, labels)
|
53
|
+
return false unless category == :integrations_be
|
54
|
+
|
55
|
+
has_capability?(project, category, :reviewer, labels)
|
56
|
+
end
|
57
|
+
|
58
|
+
def integrations_fe?(project, category, labels)
|
59
|
+
return false unless category == :integrations_fe
|
60
|
+
|
61
|
+
has_capability?(project, category, :reviewer, labels)
|
62
|
+
end
|
63
|
+
|
52
64
|
def markdown_name(author: nil)
|
53
65
|
"#{@markdown_name} (#{utc_offset_text(author)})"
|
54
66
|
end
|
@@ -95,12 +107,18 @@ module Gitlab
|
|
95
107
|
area = role[/Software Engineer in Test(?:.*?, (\w+))/, 1]
|
96
108
|
|
97
109
|
area && labels.any?("devops::#{area.downcase}") if kind == :reviewer
|
98
|
-
when :engineering_productivity
|
110
|
+
when :tooling, :engineering_productivity # Deprecated as of 2.3.0 in favor of tooling
|
99
111
|
return false unless role[/Engineering Productivity/]
|
100
112
|
return true if kind == :reviewer
|
101
113
|
return true if capabilities(project).include?("#{kind} engineering_productivity")
|
102
114
|
|
103
115
|
capabilities(project).include?("#{kind} backend")
|
116
|
+
when :integrations_be
|
117
|
+
kind == :reviewer &&
|
118
|
+
role.match?(/Backend Engineer.+Ecosystem:Integrations/)
|
119
|
+
when :integrations_fe
|
120
|
+
kind == :reviewer &&
|
121
|
+
role.match?(/Frontend Engineer.+Ecosystem:Integrations/)
|
104
122
|
when nil
|
105
123
|
capabilities(project).include?("#{kind}")
|
106
124
|
else
|
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: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-gitlab
|