gitlab-dangerfiles 3.6.5 → 3.6.7

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: 1a126428046a10355043b190fbf80e70dec6c01a6e9d8778770455a8c30d748c
4
- data.tar.gz: 65060b4bd492f3887c22fb6a09fba51c5262f4680e45c364a1ec775a1968a844
3
+ metadata.gz: e8d0bdb87447c7436d0814db68d0e65423a2d693a2d89abdf59331cff1287253
4
+ data.tar.gz: b79304e093b0be5dc9d0609b957c318c4e672b48a49263624bb9b3922885dfe4
5
5
  SHA512:
6
- metadata.gz: 4ca9f2ea3ebf80b9fa8f0f7ce19a01309acc2e120c8661fd618f59b0e48bf638098826257050be4af32cc9553c797dd3af1cd7a1784d234f27c240ec407a6ada
7
- data.tar.gz: 14ba2e996756f8beab4e046e87a1d6739285cdf55dbdcf357bdc6768f8a1ff7101797e6c5baf7fce90aa28dfbe3f41c28f3b386a4351090003162368271432cc
6
+ metadata.gz: 3173b6d8ec73814d7b0d3fdcf32270178fc76b38024ab4ba41cf106589f5f7fa4b9f0dfea9cb8fc9213b011c39691a695948caaca58455b80135e6c9af13d071
7
+ data.tar.gz: f0922b64b753e15aff30716ca1a6ade6afc6b74bbeda983dfa29190a382990e7d21311175b058f3ef26d7071273426a5ea66e8a8843a57f18411e284f07fe38c
data/.gitlab-ci.yml CHANGED
@@ -35,7 +35,7 @@ test:rspec:
35
35
  - bundle exec rspec
36
36
  parallel:
37
37
  matrix:
38
- - RUBY_VERSION: ['2.7', '3.0']
38
+ - RUBY_VERSION: ['3.0', '3.1', '3.2']
39
39
 
40
40
  test:rubocop:
41
41
  extends: .default
@@ -44,7 +44,7 @@ test:rubocop:
44
44
  - bundle exec rubocop -P -E .
45
45
  parallel:
46
46
  matrix:
47
- - RUBY_VERSION: ['2.7', '3.0']
47
+ - RUBY_VERSION: ['3.0', '3.1', '3.2']
48
48
 
49
49
  test:rufo:
50
50
  extends: .default
@@ -53,7 +53,7 @@ test:rufo:
53
53
  - bundle exec rufo --check .
54
54
  parallel:
55
55
  matrix:
56
- - RUBY_VERSION: ['2.7', '3.0']
56
+ - RUBY_VERSION: ['3.0', '3.1', '3.2']
57
57
 
58
58
  include:
59
59
  - template: Security/Dependency-Scanning.gitlab-ci.yml
data/.rubocop.yml CHANGED
@@ -27,6 +27,8 @@ RSpec/FilePath:
27
27
 
28
28
  Style/HashSyntax:
29
29
  EnforcedStyle: ruby19_no_mixed_keys
30
+ # Introduced in Ruby 3.1. Disable for now.
31
+ EnforcedShorthandSyntax: never
30
32
 
31
33
  # To respect rufo formatting
32
34
  Style/StringLiterals:
@@ -16,9 +16,9 @@ module Danger
16
16
  CHANGELOG_MODIFIED_URL_TEXT = "**CHANGELOG.md was edited.** Please remove the additions and follow the [changelog guidelines](https://docs.gitlab.com/ee/development/changelog.html).\n\n"
17
17
  CHANGELOG_MISSING_URL_TEXT = "**[CHANGELOG missing](https://docs.gitlab.com/ee/development/changelog.html)**:\n\n"
18
18
  IF_REVERT_MR_TEXT = <<~MARKDOWN
19
- If you are in a revert MR, consider using the revert MR template to add labels to skip changelog checks ([docs](https://docs.gitlab.com/ee/development/pipelines#revert-mrs)).
19
+ In a revert merge request? Use the revert merge request template to add labels [that skip changelog checks](https://docs.gitlab.com/ee/development/pipelines#revert-mrs).
20
20
 
21
- If this is reverting something in the current milestone, we don't need to add a changelog. In this case, we can skip changelog checks by adding `~"regression:*"` label, and re-run the danger job (there is a link at the bottom of this comment).
21
+ Reverting something in the current milestone? A changelog isn't required. Skip changelog checks by adding `~"regression:*"` label, then re-run the danger job (there is a link at the bottom of this comment).
22
22
  MARKDOWN
23
23
 
24
24
  OPTIONAL_CHANGELOG_MESSAGE = {
@@ -137,7 +137,7 @@ module Danger
137
137
  check_result.error(modified_text) if git.modified_files.include?("CHANGELOG.md")
138
138
 
139
139
  # Help the user to apply the correct labels to skip this danger check in case it's a revert MR
140
- check_result.warning(IF_REVERT_MR_TEXT)
140
+ check_result.warning(IF_REVERT_MR_TEXT) if helper.revert_mr?
141
141
 
142
142
  add_danger_messages(check_result)
143
143
  end
@@ -120,6 +120,10 @@ module Danger
120
120
  end
121
121
  end
122
122
 
123
+ def warnings
124
+ @warnings ||= []
125
+ end
126
+
123
127
  private
124
128
 
125
129
  def spin_for_approval_rule?(rule)
@@ -258,16 +262,18 @@ module Danger
258
262
  #
259
263
  # @param [String] url
260
264
  #
261
- # @return [Hash, Array]
265
+ # @return [Hash, Array, NilClass]
262
266
  def http_get_json(url)
263
267
  rsp = Net::HTTP.get_response(URI.parse(url))
264
268
 
265
269
  if rsp.is_a?(Net::HTTPRedirection)
266
- raise "Redirection detected: #{rsp.header["location"]}"
270
+ warnings << "Redirection detected. Stopping."
271
+ return nil
267
272
  end
268
273
 
269
274
  unless rsp.is_a?(Net::HTTPOK)
270
- raise HTTPError, "Failed to read #{url}: #{rsp.code} #{rsp.message}"
275
+ warnings << "HTTPError: Failed to read #{url}: #{rsp.code}."
276
+ return nil
271
277
  end
272
278
 
273
279
  JSON.parse(rsp.body)
@@ -279,10 +285,11 @@ module Danger
279
285
  # @return [Array<Gitlab::Dangerfiles::Teammate>]
280
286
  def company_members
281
287
  @company_members ||= begin
282
- data = http_get_json(ROULETTE_DATA_URL)
288
+ data = http_get_json(ROULETTE_DATA_URL) || []
283
289
  data.map { |hash| Gitlab::Dangerfiles::Teammate.new(hash) }
284
290
  rescue JSON::ParserError
285
- raise "Failed to parse JSON response from #{ROULETTE_DATA_URL}"
291
+ warnings << "Failed to parse JSON response from #{ROULETTE_DATA_URL}"
292
+ []
286
293
  end
287
294
  end
288
295
 
@@ -39,6 +39,11 @@ TABLE_HEADER_WITHOUT_CATEGORIES = <<MARKDOWN
39
39
  | -------- | ---------- |
40
40
  MARKDOWN
41
41
 
42
+ WARNING_MESSAGE = <<MARKDOWN
43
+ ⚠ Failed to retrieve information ⚠
44
+ %{warnings}
45
+ MARKDOWN
46
+
42
47
  OPTIONAL_REVIEW_TEMPLATE = '%{role} review is optional'
43
48
  NOT_AVAILABLE_TEMPLATE = 'No %{role} available'
44
49
 
@@ -69,6 +74,12 @@ def markdown_row_for_spins(category, spins_array, show_category_column:)
69
74
  row
70
75
  end
71
76
 
77
+ def warning_list(roulette)
78
+ return unless roulette.warnings.any?
79
+
80
+ roulette.warnings.map { |warning| "* #{warning}" }.join("\n")
81
+ end
82
+
72
83
  changes = helper.changes_by_category
73
84
 
74
85
  # Replicating label based categories from:
@@ -101,5 +112,10 @@ if changes.any?
101
112
  table_header = show_category_column ? TABLE_HEADER_WITH_CATEGORIES : TABLE_HEADER_WITHOUT_CATEGORIES
102
113
 
103
114
  markdown(MESSAGE)
115
+
116
+ if (warnings = warning_list(roulette))
117
+ markdown(format(WARNING_MESSAGE, warnings: warnings))
118
+ end
119
+
104
120
  markdown(TABLE_MARKDOWN + table_header + rows.join("\n")) unless rows.empty?
105
121
  end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "3.6.5"
3
+ VERSION = "3.6.7"
4
4
  end
5
5
  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.6.5
4
+ version: 3.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-16 00:00:00.000000000 Z
11
+ date: 2023-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake