gitlab-dangerfiles 3.4.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger/plugins/roulette.rb +4 -0
- data/lib/gitlab/dangerfiles/version.rb +1 -1
- data/lib/gitlab/dangerfiles.rb +24 -25
- 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: bcb56a4513a5f26239f800a2692bd8feedc8fed15bd2d4d2d93d9d2203e0df70
|
4
|
+
data.tar.gz: 0fd4fd6f9cacee27bf394c2b5ef17a7fee6b34b45b215e08524d5641fc0b092d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bcfa9f04ce155b7e77393c9d8e2eef9ab6534111f2ce5eaa33d484ed5e811827172ba90f40589b81f1987fd35277eab91afcd5365282e4deb94de92752d5054
|
7
|
+
data.tar.gz: 526c301f0e148a4ed6faf4dcffb3afa4d142ab828eb36eb8e745783ba80964a769a4e3456683ad1898d0d4328bc3f25f5847557042fad7ae9f53b20b7d2e22e1
|
@@ -226,6 +226,10 @@ module Danger
|
|
226
226
|
def http_get_json(url)
|
227
227
|
rsp = Net::HTTP.get_response(URI.parse(url))
|
228
228
|
|
229
|
+
if rsp.is_a?(Net::HTTPRedirection)
|
230
|
+
raise "Redirection detected: #{rsp.header["location"]}"
|
231
|
+
end
|
232
|
+
|
229
233
|
unless rsp.is_a?(Net::HTTPOK)
|
230
234
|
raise HTTPError, "Failed to read #{url}: #{rsp.code} #{rsp.message}"
|
231
235
|
end
|
data/lib/gitlab/dangerfiles.rb
CHANGED
@@ -58,7 +58,7 @@ module Gitlab
|
|
58
58
|
danger_plugin.import_plugin(File.expand_path("../danger/plugins/*.rb", __dir__))
|
59
59
|
|
60
60
|
Dir.glob(File.expand_path("danger/plugins/*.rb", config.project_root)).sort.each do |path|
|
61
|
-
puts "Importing plugin at #{path}" if
|
61
|
+
puts "Importing plugin at #{path}" if helper_plugin.ci?
|
62
62
|
danger_plugin.import_plugin(path)
|
63
63
|
end
|
64
64
|
end
|
@@ -87,10 +87,9 @@ module Gitlab
|
|
87
87
|
return if helper_plugin.release_automation?
|
88
88
|
|
89
89
|
rules = filtered_rules(only, except)
|
90
|
-
puts "Running rules: #{rules}\n" if dangerfile.verbose
|
91
90
|
|
92
91
|
rules.each do |rule, path|
|
93
|
-
puts "Importing rule #{rule} at #{path}" if
|
92
|
+
puts "Importing rule #{rule} at #{path}" if helper_plugin.ci?
|
94
93
|
danger_plugin.import_dangerfile(path: path)
|
95
94
|
end
|
96
95
|
end
|
@@ -116,45 +115,45 @@ module Gitlab
|
|
116
115
|
|
117
116
|
attr_reader :dangerfile
|
118
117
|
|
118
|
+
def filtered_rules(only_rules, except_rules)
|
119
|
+
only_rules = Array(only_rules).compact.map(&:to_s)
|
120
|
+
|
121
|
+
rules = allowed_rules_based_on_context.reject { |rule, _v| except_rules.include?(rule) }
|
122
|
+
|
123
|
+
if only_rules.any?
|
124
|
+
rules.select! { |rule, _v| only_rules.include?(rule) }
|
125
|
+
end
|
126
|
+
|
127
|
+
rules.sort.to_h
|
128
|
+
end
|
129
|
+
|
130
|
+
def allowed_rules_based_on_context
|
131
|
+
helper_plugin.ci? ? all_rules : local_rules
|
132
|
+
end
|
133
|
+
|
134
|
+
def all_rules
|
135
|
+
all_gem_rules.merge(custom_rules)
|
136
|
+
end
|
137
|
+
|
119
138
|
def all_gem_rules
|
120
|
-
@all_gem_rules ||= Dir.glob(File.join(RULES_DIR, "*")).
|
139
|
+
@all_gem_rules ||= Dir.glob(File.join(RULES_DIR, "*")).each_with_object({}) do |path, memo|
|
121
140
|
rule_name = File.basename(path)
|
122
141
|
memo[rule_name] = path if File.directory?(path) && File.exist?(File.join(path, "Dangerfile"))
|
123
142
|
end
|
124
143
|
end
|
125
144
|
|
126
145
|
def custom_rules
|
127
|
-
@custom_rules ||= Dir.glob(File.expand_path("danger/*", config.project_root)).
|
146
|
+
@custom_rules ||= Dir.glob(File.expand_path("danger/*", config.project_root)).each_with_object({}) do |path, memo|
|
128
147
|
rule_name = File.basename(path)
|
129
148
|
memo[rule_name] = path if File.directory?(path) && File.exist?(File.join(path, "Dangerfile"))
|
130
149
|
end
|
131
150
|
end
|
132
151
|
|
133
|
-
def all_rules
|
134
|
-
all_gem_rules.merge(custom_rules)
|
135
|
-
end
|
136
|
-
|
137
152
|
def local_rules
|
138
153
|
ci_only_rules = CI_ONLY_RULES | config.ci_only_rules
|
139
154
|
all_rules.reject { |rule, _v| ci_only_rules.include?(rule) }
|
140
155
|
end
|
141
156
|
|
142
|
-
def allowed_rules_based_on_context
|
143
|
-
helper_plugin.ci? ? all_rules : local_rules
|
144
|
-
end
|
145
|
-
|
146
|
-
def filtered_rules(only_rules, except_rules)
|
147
|
-
only_rules = Array(only_rules).compact.map(&:to_s)
|
148
|
-
|
149
|
-
rules = allowed_rules_based_on_context.reject { |rule, _v| except_rules.include?(rule) }
|
150
|
-
|
151
|
-
if only_rules.any?
|
152
|
-
rules.select! { |rule, _v| only_rules.include?(rule) }
|
153
|
-
end
|
154
|
-
|
155
|
-
rules
|
156
|
-
end
|
157
|
-
|
158
157
|
def danger_plugin
|
159
158
|
@danger_plugin ||= dangerfile.plugins[Danger::DangerfileDangerPlugin]
|
160
159
|
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.
|
4
|
+
version: 3.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|