danger 8.2.1 → 8.2.2

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: 3930680bc519ec86948df5375ea6ffad444929619c7faf3190e204eee827767b
4
- data.tar.gz: 6ca8c826a895e9d0ef6bf66343e70110026a8a77fafddc6e72f26b129c37801d
3
+ metadata.gz: 251a83485fbb01f15fb71afc1e76bed01879d166f6899407c2bee22416fa5ca7
4
+ data.tar.gz: 0fbbc7ce20a833a55e2be4b842e4e89d70a130038c0eec0408396892ceba215c
5
5
  SHA512:
6
- metadata.gz: '0267983777b8a27f5d90f6221655d18657a0c4ed6276e475631e4984eabbe2f5329ec8df774100052dfd1e6368082b9865fd1bd87956b538fa032042f1e1538d'
7
- data.tar.gz: 700097f2571dd5cb9cac5b9f74d034a53a00e73f747d3aa489cb9cae83b86b85908281a3c910bec25a2299fd828449c9eb82f796d8865f84a0742a46488d2dd3
6
+ metadata.gz: 9780c2dfd1a909732b7571c0141e74d35b92cbdcfbcfad48c2b2bc713dc62e062598301b0bca38a6759ef032ea4318a2d04e5b40d8d7fccb441b2f78f4a59862
7
+ data.tar.gz: 5f93607907d82ffc36c6f5074796dfdacfd2c6771390e4bda57405c3c0f1f1545506a7f03b95b536fec763313612f24f27f4c20e9b4e4603570e0ab1b7e6f572
@@ -19,7 +19,7 @@ module Danger
19
19
  #
20
20
  class AzurePipelines < CI
21
21
  def self.validates_as_ci?(env)
22
- env.key? "AGENT_ID"
22
+ env.key?("AGENT_ID") && env["BUILD_REPOSITORY_PROVIDER"] != "TfsGit"
23
23
  end
24
24
 
25
25
  def self.validates_as_pr?(env)
@@ -49,22 +49,26 @@ module Danger
49
49
  # However, as we're using using them in the DSL, they won't
50
50
  # get method_missing called correctly without overriding them.
51
51
 
52
- def warn(*args, &blk)
53
- method_missing(:warn, *args, &blk)
52
+ def warn(*args, **kargs, &blk)
53
+ method_missing(:warn, *args, **kargs, &blk)
54
54
  end
55
55
 
56
- def fail(*args, &blk)
57
- method_missing(:fail, *args, &blk)
56
+ def fail(*args, **kargs, &blk)
57
+ method_missing(:fail, *args, **kargs, &blk)
58
58
  end
59
59
 
60
60
  # When an undefined method is called, we check to see if it's something
61
61
  # that the core DSLs have, then starts looking at plugins support.
62
62
 
63
63
  # rubocop:disable Style/MethodMissing
64
- def method_missing(method_sym, *arguments, &_block)
64
+ def method_missing(method_sym, *arguments, **keyword_arguments, &_block)
65
65
  @core_plugins.each do |plugin|
66
66
  if plugin.public_methods(false).include?(method_sym)
67
- return plugin.send(method_sym, *arguments)
67
+ if keyword_arguments.empty?
68
+ return plugin.send(method_sym, *arguments)
69
+ else
70
+ return plugin.send(method_sym, *arguments, **keyword_arguments)
71
+ end
68
72
  end
69
73
  end
70
74
  super
@@ -90,6 +90,8 @@ module Danger
90
90
  RequestSources::GitLab
91
91
  elsif repo_url =~ /bitbucket\.(org|com)/i
92
92
  RequestSources::BitbucketCloud
93
+ elsif repo_url =~ /dev\.azure\.com/i
94
+ RequestSources::VSTS
93
95
  end
94
96
  end
95
97
 
@@ -19,8 +19,12 @@ module Danger
19
19
  # We need to redirect the self calls to the Dangerfile
20
20
 
21
21
  # rubocop:disable Style/MethodMissing
22
- def method_missing(method_sym, *arguments, &block)
23
- @dangerfile.send(method_sym, *arguments, &block)
22
+ def method_missing(method_sym, *arguments, **keyword_arguments, &block)
23
+ if keyword_arguments.empty?
24
+ @dangerfile.send(method_sym, *arguments, &block)
25
+ else
26
+ @dangerfile.send(method_sym, *arguments, **keyword_arguments, &block)
27
+ end
24
28
  end
25
29
 
26
30
  def self.all_plugins
@@ -95,12 +95,13 @@ module Danger
95
95
  "#{base_url(2)}/#{pull_request_id}"
96
96
  end
97
97
 
98
- def prs_api_endpoint(branch_name)
99
- "#{base_url(2)}?q=source.branch.name=\"#{branch_name}\""
98
+ def prs_api_url(branch_name)
99
+ encoded_branch_name = URI.encode_www_form_component(branch_name)
100
+ "#{base_url(2)}?q=source.branch.name=\"#{encoded_branch_name}\""
100
101
  end
101
102
 
102
103
  def fetch_pr_from_branch(branch_name)
103
- uri = URI(URI.escape(prs_api_endpoint(branch_name)))
104
+ uri = URI(prs_api_url(branch_name))
104
105
  fetch_json(uri)[:values][0][:id]
105
106
  end
106
107
 
@@ -85,7 +85,7 @@ module Danger
85
85
  if supports_inline_comments
86
86
  @raw_comments = mr_discussions
87
87
  .auto_paginate
88
- .flat_map { |discussion| discussion.notes.map { |note| note.merge({"discussion_id" => discussion.id}) } }
88
+ .flat_map { |discussion| discussion.notes.map { |note| note.to_h.merge({"discussion_id" => discussion.id}) } }
89
89
  @raw_comments
90
90
  .map { |comment| Comment.from_gitlab(comment) }
91
91
  else
@@ -359,7 +359,7 @@ module Danger
359
359
  def submit_inline_comments!(warnings: [], errors: [], messages: [], markdowns: [], previous_violations: [], danger_id: "danger")
360
360
  comments = mr_discussions
361
361
  .auto_paginate
362
- .flat_map { |discussion| discussion.notes.map { |note| note.merge({"discussion_id" => discussion.id}) } }
362
+ .flat_map { |discussion| discussion.notes.map { |note| note.to_h.merge({"discussion_id" => discussion.id}) } }
363
363
  .select { |comment| Comment.from_gitlab(comment).inline? }
364
364
 
365
365
  danger_comments = comments.select { |comment| Comment.from_gitlab(comment).generated_by_danger?(danger_id) }
@@ -410,7 +410,7 @@ module Danger
410
410
  next false unless m.file && m.line
411
411
  # Reject if it's out of range and in dismiss mode
412
412
  next true if dismiss_out_of_range_messages_for(kind) && is_out_of_range(mr_changes.changes, m)
413
-
413
+
414
414
  # Once we know we're gonna submit it, we format it
415
415
  if is_markdown_content
416
416
  body = generate_inline_markdown_body(m, danger_id: danger_id, template: "gitlab")
@@ -531,10 +531,10 @@ module Danger
531
531
  end
532
532
 
533
533
  def is_out_of_range(changes, message)
534
- change = changes.find { |c| c["new_path"] == message.file }
534
+ change = changes.find { |c| c["new_path"] == message.file }
535
535
  # If there is no changes or rename only or deleted, return out of range.
536
536
  return true if change.nil? || change["diff"].empty? || change["deleted_file"]
537
-
537
+
538
538
  # If new file then return in range
539
539
  return false if change["new_file"]
540
540
 
@@ -544,7 +544,7 @@ module Danger
544
544
  return true
545
545
  end
546
546
 
547
- def generate_addition_lines(diff)
547
+ def generate_addition_lines(diff)
548
548
  range_header_regexp = /@@ -(?<old>[0-9]+)(,([0-9]+))? \+(?<new>[0-9]+)(,([0-9]+))? @@.*/
549
549
  addition_lines = []
550
550
  line_number = 0
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "8.2.1".freeze
2
+ VERSION = "8.2.2".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: 8.2.1
4
+ version: 8.2.2
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: 2020-11-09 00:00:00.000000000 Z
12
+ date: 2021-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide