danger 8.2.1 → 8.2.2
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/lib/danger/ci_source/azure_pipelines.rb +1 -1
- data/lib/danger/danger_core/dangerfile.rb +10 -6
- data/lib/danger/danger_core/environment_manager.rb +2 -0
- data/lib/danger/plugin_support/plugin.rb +6 -2
- data/lib/danger/request_sources/bitbucket_cloud_api.rb +4 -3
- data/lib/danger/request_sources/gitlab.rb +6 -6
- data/lib/danger/version.rb +1 -1
- 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: 251a83485fbb01f15fb71afc1e76bed01879d166f6899407c2bee22416fa5ca7
|
4
|
+
data.tar.gz: 0fbbc7ce20a833a55e2be4b842e4e89d70a130038c0eec0408396892ceba215c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9780c2dfd1a909732b7571c0141e74d35b92cbdcfbcfad48c2b2bc713dc62e062598301b0bca38a6759ef032ea4318a2d04e5b40d8d7fccb441b2f78f4a59862
|
7
|
+
data.tar.gz: 5f93607907d82ffc36c6f5074796dfdacfd2c6771390e4bda57405c3c0f1f1545506a7f03b95b536fec763313612f24f27f4c20e9b4e4603570e0ab1b7e6f572
|
@@ -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
|
-
|
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
|
@@ -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
|
-
|
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
|
99
|
-
|
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(
|
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
|
data/lib/danger/version.rb
CHANGED
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.
|
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:
|
12
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|