gitlab-dangerfiles 2.3.0 → 2.5.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/CODEOWNERS +1 -0
- data/.gitlab-ci.yml +6 -0
- data/Dangerfile +10 -0
- data/Gemfile +4 -0
- data/README.md +0 -1
- data/lib/danger/plugins/helper.rb +4 -1
- data/lib/danger/plugins/roulette.rb +5 -0
- data/lib/gitlab/dangerfiles/base_linter.rb +5 -1
- data/lib/gitlab/dangerfiles/commit_linter.rb +9 -4
- data/lib/gitlab/dangerfiles/teammate.rb +27 -1
- data/lib/gitlab/dangerfiles/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93e497ecb88959ef6d916e995491d4a17644b2875b765a87d1b8dbf2a2e245cd
|
4
|
+
data.tar.gz: 2060f3bb306e1abf440eb4d2eead9f4a97dd5999d28a691fe119260fcf338b45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a447e73d6550265ddf775674190816341bd07f484be816b7583fc3b70427bcfb2b1a0c9aa86b651486bed62953a8e97838c58527eee11af4c169f2633d7d2f
|
7
|
+
data.tar.gz: f85733f1b015c3170cafc990b0cf84c773ed8532f11e3978b59d21477ad592d8095ff6b46b4a673da98f956c1368ed4a6501e3ae26b62c1d1c534022bbc4b88b
|
data/.gitlab/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @gl-quality/eng-prod
|
data/.gitlab-ci.yml
CHANGED
data/Dangerfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require_relative "lib/gitlab-dangerfiles"
|
2
|
+
|
3
|
+
# Get an instance of Gitlab::Dangerfiles
|
4
|
+
gitlab_dangerfiles = Gitlab::Dangerfiles::Engine.new(self)
|
5
|
+
|
6
|
+
# Import all plugins from the gem
|
7
|
+
gitlab_dangerfiles.import_plugins
|
8
|
+
|
9
|
+
# Import all rules from the gem
|
10
|
+
gitlab_dangerfiles.import_dangerfiles
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -16,12 +16,15 @@ module Danger
|
|
16
16
|
docs: "~documentation", # Docs are reviewed along DevOps stages, so don't need roulette for now.
|
17
17
|
none: "",
|
18
18
|
qa: "~QA",
|
19
|
+
ux: "~UX",
|
19
20
|
test: "~test ~Quality for `spec/features/*`",
|
20
21
|
# Deprecated as of 2.3.0 in favor of tooling
|
21
22
|
engineering_productivity: '~"Engineering Productivity" for CI, Danger',
|
22
|
-
tooling: "
|
23
|
+
tooling: '~"type::tooling" for CI, Danger',
|
23
24
|
ci_template: '~"ci::templates"',
|
24
25
|
product_intelligence: '~"product intelligence"',
|
26
|
+
integrations_be: '~"group::integrations" (backend)',
|
27
|
+
integrations_fe: '~"group::integrations" (frontend)',
|
25
28
|
}.freeze
|
26
29
|
|
27
30
|
# Allows to set specific rule's configuration by passing a block.
|
@@ -34,6 +34,9 @@ module Danger
|
|
34
34
|
#
|
35
35
|
# @return [Array<Spin>]
|
36
36
|
def spin(project, categories = [nil], timezone_experiment: false)
|
37
|
+
project = project.downcase
|
38
|
+
categories = categories.map { |category| category&.downcase }
|
39
|
+
|
37
40
|
spins = categories.sort_by(&:to_s).map do |category|
|
38
41
|
including_timezone = INCLUDE_TIMEZONE_FOR_CATEGORY.fetch(category, timezone_experiment)
|
39
42
|
|
@@ -75,6 +78,8 @@ module Danger
|
|
75
78
|
# Fetch an already picked maintainer, or pick one otherwise
|
76
79
|
spin.maintainer = backend_spin&.maintainer || frontend_spin&.maintainer || spin_for_category(project, :backend, timezone_experiment: including_timezone).maintainer
|
77
80
|
end
|
81
|
+
when :integrations_be, :integrations_fe
|
82
|
+
spin.optional_role = :maintainer
|
78
83
|
end
|
79
84
|
end
|
80
85
|
|
@@ -28,6 +28,10 @@ module Gitlab
|
|
28
28
|
@problems = {}
|
29
29
|
end
|
30
30
|
|
31
|
+
def inspect
|
32
|
+
"#{self.class}:#{object_id} @commit=#{@commit} @problems=#{@problems}"
|
33
|
+
end
|
34
|
+
|
31
35
|
def failed?
|
32
36
|
problems.any?
|
33
37
|
end
|
@@ -78,7 +82,7 @@ module Gitlab
|
|
78
82
|
return false if subject.empty?
|
79
83
|
return false if ("A".."Z").cover?(subject[0])
|
80
84
|
|
81
|
-
first_char = subject.sub(/\A(\[
|
85
|
+
first_char = subject.sub(/\A(\[[^\]]+\]|[^:\s]+:)\s/, "")[0]
|
82
86
|
first_char_downcased = first_char.downcase
|
83
87
|
return true unless ("a".."z").cover?(first_char_downcased)
|
84
88
|
|
@@ -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
|
@@ -12,7 +12,7 @@ module Gitlab
|
|
12
12
|
@name = options["name"]
|
13
13
|
@markdown_name = options["markdown_name"]
|
14
14
|
@role = options["role"]
|
15
|
-
@projects = options["projects"]
|
15
|
+
@projects = process_projects(options["projects"])
|
16
16
|
@available = options["available"]
|
17
17
|
@hungry = options["hungry"]
|
18
18
|
@reduced_capacity = options["reduced_capacity"]
|
@@ -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
|
@@ -67,6 +79,14 @@ module Gitlab
|
|
67
79
|
|
68
80
|
private
|
69
81
|
|
82
|
+
def process_projects(projects)
|
83
|
+
return nil unless projects
|
84
|
+
|
85
|
+
projects.each_with_object({}) do |(project, capabilities), all|
|
86
|
+
all[project.downcase] = Array(capabilities).map(&:downcase)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
70
90
|
def utc_offset_text(author = nil)
|
71
91
|
offset_text = if floored_offset_hours >= 0
|
72
92
|
"UTC+#{floored_offset_hours}"
|
@@ -101,6 +121,12 @@ module Gitlab
|
|
101
121
|
return true if capabilities(project).include?("#{kind} engineering_productivity")
|
102
122
|
|
103
123
|
capabilities(project).include?("#{kind} backend")
|
124
|
+
when :integrations_be
|
125
|
+
kind == :reviewer &&
|
126
|
+
role.match?(/Backend Engineer.+Ecosystem:Integrations/)
|
127
|
+
when :integrations_fe
|
128
|
+
kind == :reviewer &&
|
129
|
+
role.match?(/Frontend Engineer.+Ecosystem:Integrations/)
|
104
130
|
when nil
|
105
131
|
capabilities(project).include?("#{kind}")
|
106
132
|
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.5.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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-gitlab
|
@@ -131,10 +131,12 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
133
|
- ".gitlab-ci.yml"
|
134
|
+
- ".gitlab/CODEOWNERS"
|
134
135
|
- ".gitlab/merge_request_templates/Release.md"
|
135
136
|
- ".rspec"
|
136
137
|
- ".yardopts"
|
137
138
|
- CODE_OF_CONDUCT.md
|
139
|
+
- Dangerfile
|
138
140
|
- Gemfile
|
139
141
|
- Guardfile
|
140
142
|
- LICENSE.txt
|