danger 9.4.2 → 9.4.3

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: 159f9e62814cd8724e55f7f8584d936e87baec3b6ebb554a37e7990b60a911c1
4
- data.tar.gz: cff0e62eb89fc5893521f8116a0c97c084fa460c7702508565914b719f872d3b
3
+ metadata.gz: 235adb876d4329ef24664c6139ed7266298db3f672415e83cf78d1b9dfb87af9
4
+ data.tar.gz: 359771a09da8778f29d3d6d0fa26d803474813ae8d4a154fdef66489f7b3919b
5
5
  SHA512:
6
- metadata.gz: e6ea6863e7becfab88b477d72ee6c0c077db24db33773d0fb9948b641e2ee088be8086340091adfb4c85933458ae5c51f1f075babc49009bd0d2f6544b8f011f
7
- data.tar.gz: 5b3288475743c4156a12edbb2e68666622fedc16726714243572f29740b686c54050f01e9bf042b2a9bbba45c646a8933a5cfcd22b3b4b431aaa56edb8dbfe8f
6
+ metadata.gz: ee8c64ffa617f2dc8e4c9dd00861dfac8243c6898cd4b10f2185358b95bbe3278ab6d3265db375cd6cb7fc33d1b5e6c7499db879a735f8e22e46737e5fc8a2da
7
+ data.tar.gz: 82bc4ac05e20fda0f0fc0936ed14eeadb8446effd43f65c673edbdcb6af364c3c0c22106bf8e3d667e1efba1e11ee9e9d9d83b7f13818b85779159f9bcbed9ad
@@ -5,8 +5,8 @@ require "danger/helpers/message_groups_array_helper"
5
5
 
6
6
  module Danger
7
7
  class MessageAggregator
8
- def self.aggregate(*args)
9
- new(*args).aggregate
8
+ def self.aggregate(*args, **kwargs)
9
+ new(*args, **kwargs).aggregate
10
10
  end
11
11
 
12
12
  def initialize(warnings: [],
@@ -252,14 +252,16 @@ module Danger
252
252
  end
253
253
 
254
254
  def submit_inline_comments!(warnings: [], errors: [], messages: [], markdowns: [], previous_violations: [], danger_id: "danger")
255
- # Avoid doing any fetchs if there's no inline comments
256
- return {} if (warnings + errors + messages + markdowns).select(&:inline?).empty?
257
-
258
- diff_lines = self.pr_diff.lines
259
255
  pr_comments = client.pull_request_comments(ci_source.repo_slug, ci_source.pull_request_id)
260
256
  danger_comments = pr_comments.select { |comment| Comment.from_github(comment).generated_by_danger?(danger_id) }
261
257
  non_danger_comments = pr_comments - danger_comments
262
258
 
259
+ if (warnings + errors + messages + markdowns).select(&:inline?).empty?
260
+ delete_old_inline_violations(danger_comments: danger_comments, non_danger_comments: non_danger_comments)
261
+ return {}
262
+ end
263
+
264
+ diff_lines = self.pr_diff.lines
263
265
  warnings = submit_inline_comments_for_kind!(:warning, warnings, diff_lines, danger_comments, previous_violations["warning"], danger_id: danger_id)
264
266
  errors = submit_inline_comments_for_kind!(:error, errors, diff_lines, danger_comments, previous_violations["error"], danger_id: danger_id)
265
267
  messages = submit_inline_comments_for_kind!(:message, messages, diff_lines, danger_comments, previous_violations["message"], danger_id: danger_id)
@@ -267,6 +269,17 @@ module Danger
267
269
 
268
270
  # submit removes from the array all comments that are still in force
269
271
  # so we strike out all remaining ones
272
+ delete_old_inline_violations(danger_comments: danger_comments, non_danger_comments: non_danger_comments)
273
+
274
+ {
275
+ warnings: warnings,
276
+ errors: errors,
277
+ messages: messages,
278
+ markdowns: markdowns
279
+ }
280
+ end
281
+
282
+ def delete_old_inline_violations(danger_comments: [], non_danger_comments: [])
270
283
  danger_comments.each do |comment|
271
284
  violation = violations_from_table(comment["body"]).first
272
285
  if !violation.nil? && violation.sticky
@@ -285,13 +298,6 @@ module Danger
285
298
  client.delete_pull_request_comment(ci_source.repo_slug, comment["id"]) if replies.empty?
286
299
  end
287
300
  end
288
-
289
- {
290
- warnings: warnings,
291
- errors: errors,
292
- messages: messages,
293
- markdowns: markdowns
294
- }
295
301
  end
296
302
 
297
303
  def messages_are_equivalent(m1, m2)
@@ -343,8 +349,10 @@ module Danger
343
349
 
344
350
  if matching_comments.empty?
345
351
  begin
352
+ # Since Octokit v8, the signature of create_pull_request_comment has been changed.
353
+ # See https://github.com/danger/danger/issues/1475 for detailed information.
346
354
  client.create_pull_request_comment(ci_source.repo_slug, ci_source.pull_request_id,
347
- body, head_ref, m.file, position)
355
+ body, head_ref, m.file, (Octokit::MAJOR >= 8 ? m.line : position))
348
356
  rescue Octokit::UnprocessableEntity => e
349
357
  # Show more detail for UnprocessableEntity error
350
358
  message = [e, "body: #{body}", "head_ref: #{head_ref}", "filename: #{m.file}", "position: #{position}"].join("\n")
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "9.4.2".freeze
2
+ VERSION = "9.4.3".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.4.2
4
+ version: 9.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orta Therox
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-12-13 00:00:00.000000000 Z
12
+ date: 2024-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -344,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
344
  - !ruby/object:Gem::Version
345
345
  version: '0'
346
346
  requirements: []
347
- rubygems_version: 3.3.26
347
+ rubygems_version: 3.3.7
348
348
  signing_key:
349
349
  specification_version: 4
350
350
  summary: Like Unit Tests, but for your Team Culture.