danger 9.1.0 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/danger +1 -1
- data/lib/danger/ci_source/appcircle.rb +71 -71
- data/lib/danger/ci_source/appveyor.rb +1 -0
- data/lib/danger/ci_source/azure_pipelines.rb +20 -5
- data/lib/danger/ci_source/bamboo.rb +1 -1
- data/lib/danger/ci_source/bitbucket_pipelines.rb +1 -2
- data/lib/danger/ci_source/bitrise.rb +3 -3
- data/lib/danger/ci_source/buildkite.rb +1 -1
- data/lib/danger/ci_source/circle_api.rb +2 -2
- data/lib/danger/ci_source/code_build.rb +1 -1
- data/lib/danger/ci_source/codefresh.rb +1 -1
- data/lib/danger/ci_source/concourse.rb +4 -5
- data/lib/danger/ci_source/dotci.rb +4 -6
- data/lib/danger/ci_source/github_actions.rb +6 -6
- data/lib/danger/ci_source/gitlab_ci.rb +4 -4
- data/lib/danger/ci_source/jenkins.rb +21 -22
- data/lib/danger/ci_source/local_git_repo.rb +7 -1
- data/lib/danger/ci_source/local_only_git_repo.rb +1 -0
- data/lib/danger/ci_source/support/find_repo_info_from_url.rb +11 -10
- data/lib/danger/ci_source/support/pull_request_finder.rb +15 -7
- data/lib/danger/ci_source/teamcity.rb +1 -1
- data/lib/danger/ci_source/xcode_cloud.rb +7 -7
- data/lib/danger/commands/init.rb +1 -1
- data/lib/danger/commands/local.rb +1 -1
- data/lib/danger/commands/local_helpers/http_cache.rb +2 -0
- data/lib/danger/commands/local_helpers/local_setup.rb +2 -0
- data/lib/danger/commands/local_helpers/pry_setup.rb +1 -0
- data/lib/danger/commands/plugins/plugin_json.rb +1 -3
- data/lib/danger/commands/plugins/plugin_lint.rb +0 -2
- data/lib/danger/commands/plugins/plugin_readme.rb +2 -5
- data/lib/danger/commands/runner.rb +1 -1
- data/lib/danger/commands/staging.rb +7 -7
- data/lib/danger/commands/systems.rb +4 -6
- data/lib/danger/core_ext/file_list.rb +2 -2
- data/lib/danger/danger_core/dangerfile.rb +13 -13
- data/lib/danger/danger_core/environment_manager.rb +2 -1
- data/lib/danger/danger_core/executor.rb +10 -11
- data/lib/danger/danger_core/message_aggregator.rb +1 -0
- data/lib/danger/danger_core/messages/base.rb +1 -0
- data/lib/danger/danger_core/messages/markdown.rb +3 -4
- data/lib/danger/danger_core/messages/violation.rb +1 -2
- data/lib/danger/danger_core/plugins/dangerfile_bitbucket_cloud_plugin.rb +1 -3
- data/lib/danger/danger_core/plugins/dangerfile_bitbucket_server_plugin.rb +4 -4
- data/lib/danger/danger_core/plugins/dangerfile_danger_plugin.rb +8 -2
- data/lib/danger/danger_core/plugins/dangerfile_git_plugin.rb +3 -2
- data/lib/danger/danger_core/plugins/dangerfile_github_plugin.rb +2 -0
- data/lib/danger/danger_core/plugins/dangerfile_gitlab_plugin.rb +3 -1
- data/lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb +3 -2
- data/lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb +3 -1
- data/lib/danger/danger_core/plugins/dangerfile_vsts_plugin.rb +3 -3
- data/lib/danger/danger_core/standard_error.rb +2 -3
- data/lib/danger/helpers/comments_helper.rb +5 -5
- data/lib/danger/helpers/comments_parsing_helper.rb +3 -2
- data/lib/danger/helpers/emoji_mapper.rb +1 -1
- data/lib/danger/plugin_support/plugin.rb +0 -1
- data/lib/danger/plugin_support/plugin_linter.rb +1 -0
- data/lib/danger/request_sources/bitbucket_cloud.rb +3 -5
- data/lib/danger/request_sources/bitbucket_cloud_api.rb +2 -4
- data/lib/danger/request_sources/bitbucket_server.rb +10 -13
- data/lib/danger/request_sources/bitbucket_server_api.rb +9 -10
- data/lib/danger/request_sources/code_insights_api.rb +7 -11
- data/lib/danger/request_sources/github/github.rb +15 -14
- data/lib/danger/request_sources/github/github_review.rb +3 -2
- data/lib/danger/request_sources/github/github_review_resolver.rb +0 -2
- data/lib/danger/request_sources/github/github_review_unsupported.rb +0 -2
- data/lib/danger/request_sources/gitlab.rb +46 -58
- data/lib/danger/request_sources/local_only.rb +0 -2
- data/lib/danger/request_sources/request_source.rb +4 -4
- data/lib/danger/request_sources/support/get_ignored_violation.rb +1 -1
- data/lib/danger/request_sources/vsts.rb +8 -10
- data/lib/danger/request_sources/vsts_api.rb +5 -2
- data/lib/danger/version.rb +1 -1
- data/lib/danger.rb +1 -0
- metadata +34 -35
- data/lib/danger/ci_source/vsts.rb +0 -73
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
require "uri"
|
3
2
|
require "danger/helpers/comments_helper"
|
4
3
|
require "danger/helpers/comment"
|
@@ -72,20 +71,18 @@ module Danger
|
|
72
71
|
def mr_comments
|
73
72
|
# @raw_comments contains what we got back from the server.
|
74
73
|
# @comments contains Comment objects (that have less information)
|
75
|
-
@comments ||=
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
88
|
-
end
|
74
|
+
@comments ||= if supports_inline_comments
|
75
|
+
@raw_comments = mr_discussions
|
76
|
+
.auto_paginate
|
77
|
+
.flat_map { |discussion| discussion.notes.map { |note| note.to_h.merge({ "discussion_id" => discussion.id }) } }
|
78
|
+
@raw_comments
|
79
|
+
.map { |comment| Comment.from_gitlab(comment) }
|
80
|
+
else
|
81
|
+
@raw_comments = client.merge_request_comments(ci_source.repo_slug, ci_source.pull_request_id, per_page: 100)
|
82
|
+
.auto_paginate
|
83
|
+
@raw_comments
|
84
|
+
.map { |comment| Comment.from_gitlab(comment) }
|
85
|
+
end
|
89
86
|
end
|
90
87
|
|
91
88
|
def mr_discussions
|
@@ -96,10 +93,10 @@ module Danger
|
|
96
93
|
@mr_diff ||= begin
|
97
94
|
diffs = mr_changes.changes.map do |change|
|
98
95
|
diff = change["diff"]
|
99
|
-
if diff.start_with?(
|
96
|
+
if diff.start_with?("--- a/")
|
100
97
|
diff
|
101
98
|
else
|
102
|
-
"--- a/#{change[
|
99
|
+
"--- a/#{change['old_path']}\n+++ b/#{change['new_path']}\n#{diff}"
|
103
100
|
end
|
104
101
|
end
|
105
102
|
diffs.join("\n")
|
@@ -107,24 +104,18 @@ module Danger
|
|
107
104
|
end
|
108
105
|
|
109
106
|
def mr_changed_paths
|
110
|
-
@mr_changed_paths ||=
|
111
|
-
|
112
|
-
.changes.map { |change| change["new_path"] }
|
113
|
-
end
|
107
|
+
@mr_changed_paths ||= mr_changes
|
108
|
+
.changes.map { |change| change["new_path"] }
|
114
109
|
|
115
110
|
@mr_changed_paths
|
116
111
|
end
|
117
112
|
|
118
113
|
def mr_changes
|
119
|
-
@mr_changes ||=
|
120
|
-
client.merge_request_changes(ci_source.repo_slug, ci_source.pull_request_id)
|
121
|
-
end
|
114
|
+
@mr_changes ||= client.merge_request_changes(ci_source.repo_slug, ci_source.pull_request_id)
|
122
115
|
end
|
123
116
|
|
124
117
|
def mr_closes_issues
|
125
|
-
@mr_closes_issues ||=
|
126
|
-
client.merge_request_closes_issues(ci_source.repo_slug, ci_source.pull_request_id)
|
127
|
-
end
|
118
|
+
@mr_closes_issues ||= client.merge_request_closes_issues(ci_source.repo_slug, ci_source.pull_request_id)
|
128
119
|
end
|
129
120
|
|
130
121
|
def setup_danger_branches
|
@@ -154,16 +145,14 @@ module Danger
|
|
154
145
|
end
|
155
146
|
|
156
147
|
def supports_inline_comments
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
current_version = Gem::Version.new(client.version.version)
|
148
|
+
# If we can't check GitLab's version, we assume we don't support inline comments
|
149
|
+
@supports_inline_comments ||= if Gem.loaded_specs["gitlab"].version < FIRST_GITLAB_GEM_WITH_VERSION_CHECK
|
150
|
+
false
|
151
|
+
else
|
152
|
+
current_version = Gem::Version.new(client.version.version)
|
163
153
|
|
164
|
-
|
165
|
-
|
166
|
-
end
|
154
|
+
current_version >= FIRST_VERSION_WITH_INLINE_COMMENTS
|
155
|
+
end
|
167
156
|
end
|
168
157
|
|
169
158
|
def update_pull_request!(warnings: [], errors: [], messages: [], markdowns: [], danger_id: "danger", new_comment: false, remove_previous_comments: false)
|
@@ -253,11 +242,11 @@ module Danger
|
|
253
242
|
delete_old_comments!(danger_id: danger_id)
|
254
243
|
else
|
255
244
|
body = generate_comment(warnings: warnings,
|
256
|
-
|
245
|
+
errors: errors,
|
257
246
|
messages: messages,
|
258
|
-
|
259
|
-
|
260
|
-
|
247
|
+
markdowns: markdowns,
|
248
|
+
previous_violations: previous_violations,
|
249
|
+
danger_id: danger_id,
|
261
250
|
template: "gitlab")
|
262
251
|
|
263
252
|
if editable_comments.empty? or should_create_new_comment
|
@@ -278,11 +267,10 @@ module Danger
|
|
278
267
|
|
279
268
|
def delete_old_comments!(except: nil, danger_id: "danger")
|
280
269
|
@raw_comments.each do |raw_comment|
|
281
|
-
|
282
270
|
comment = Comment.from_gitlab(raw_comment)
|
283
271
|
next unless comment.generated_by_danger?(danger_id)
|
284
272
|
next if comment.id == except
|
285
|
-
next unless raw_comment.
|
273
|
+
next unless raw_comment.kind_of?(Hash) && raw_comment["position"].nil?
|
286
274
|
|
287
275
|
begin
|
288
276
|
client.delete_merge_request_comment(
|
@@ -290,7 +278,7 @@ module Danger
|
|
290
278
|
ci_source.pull_request_id,
|
291
279
|
comment.id
|
292
280
|
)
|
293
|
-
rescue
|
281
|
+
rescue StandardError
|
294
282
|
end
|
295
283
|
end
|
296
284
|
end
|
@@ -298,7 +286,7 @@ module Danger
|
|
298
286
|
def markdown_link_to_message(message, _)
|
299
287
|
"#{message.file}#L#{message.line}: "
|
300
288
|
end
|
301
|
-
|
289
|
+
|
302
290
|
# @return [String] The organisation name, is nil if it can't be detected
|
303
291
|
def organisation
|
304
292
|
nil # TODO: Implement this
|
@@ -315,12 +303,12 @@ module Danger
|
|
315
303
|
end
|
316
304
|
|
317
305
|
# @return [String] A URL to the specific file, ready to be downloaded
|
318
|
-
def file_url(organisation: nil, repository: nil, branch: nil, path: nil)
|
319
|
-
|
306
|
+
def file_url(organisation: nil, repository: nil, ref: nil, branch: nil, path: nil)
|
307
|
+
ref ||= (branch || "master")
|
320
308
|
# According to GitLab Repositories API docs path and id(slug) should be encoded.
|
321
309
|
path = URI.encode_www_form_component(path)
|
322
310
|
repository = URI.encode_www_form_component(repository)
|
323
|
-
"#{endpoint}/projects/#{repository}/repository/files/#{path}/raw?ref=#{
|
311
|
+
"#{endpoint}/projects/#{repository}/repository/files/#{path}/raw?ref=#{ref}&private_token=#{@token}"
|
324
312
|
end
|
325
313
|
|
326
314
|
def regular_violations_group(warnings: [], errors: [], messages: [], markdowns: [])
|
@@ -338,6 +326,7 @@ module Danger
|
|
338
326
|
next 1 unless b.file && b.line
|
339
327
|
|
340
328
|
next a.line <=> b.line if a.file == b.file
|
329
|
+
|
341
330
|
next a.file <=> b.file
|
342
331
|
end
|
343
332
|
|
@@ -359,7 +348,7 @@ module Danger
|
|
359
348
|
def submit_inline_comments!(warnings: [], errors: [], messages: [], markdowns: [], previous_violations: [], danger_id: "danger")
|
360
349
|
comments = mr_discussions
|
361
350
|
.auto_paginate
|
362
|
-
.flat_map { |discussion| discussion.notes.map { |note| note.to_h.merge({"discussion_id" => discussion.id}) } }
|
351
|
+
.flat_map { |discussion| discussion.notes.map { |note| note.to_h.merge({ "discussion_id" => discussion.id }) } }
|
363
352
|
.select { |comment| Comment.from_gitlab(comment).inline? }
|
364
353
|
|
365
354
|
danger_comments = comments.select { |comment| Comment.from_gitlab(comment).generated_by_danger?(danger_id) }
|
@@ -401,7 +390,7 @@ module Danger
|
|
401
390
|
}
|
402
391
|
end
|
403
392
|
|
404
|
-
def submit_inline_comments_for_kind!(kind, messages,
|
393
|
+
def submit_inline_comments_for_kind!(kind, messages, _diff_lines, danger_comments, previous_violations, danger_id: "danger")
|
405
394
|
previous_violations ||= []
|
406
395
|
is_markdown_content = kind == :markdown
|
407
396
|
emoji = { warning: "warning", error: "no_entry_sign", message: "book" }[kind]
|
@@ -440,7 +429,7 @@ module Danger
|
|
440
429
|
params = {
|
441
430
|
body: body,
|
442
431
|
position: {
|
443
|
-
position_type:
|
432
|
+
position_type: "text",
|
444
433
|
new_path: m.file,
|
445
434
|
new_line: m.line,
|
446
435
|
old_path: old_position[:path],
|
@@ -550,20 +539,19 @@ module Danger
|
|
550
539
|
line_number = 0
|
551
540
|
diff.each_line do |line|
|
552
541
|
if line.match range_header_regexp
|
553
|
-
line = line.split(
|
554
|
-
line = line.split(
|
555
|
-
range_string = line.split(
|
542
|
+
line = line.split("+").last
|
543
|
+
line = line.split(" ").first
|
544
|
+
range_string = line.split(",")
|
556
545
|
line_number = range_string[0].to_i - 1
|
557
|
-
elsif line.start_with?(
|
546
|
+
elsif line.start_with?("+")
|
558
547
|
addition_lines.push(line_number)
|
559
|
-
elsif line.start_with?(
|
560
|
-
line_number
|
548
|
+
elsif line.start_with?("-")
|
549
|
+
line_number -= 1
|
561
550
|
end
|
562
|
-
line_number
|
551
|
+
line_number += 1
|
563
552
|
end
|
564
553
|
addition_lines
|
565
554
|
end
|
566
|
-
|
567
555
|
end
|
568
556
|
end
|
569
557
|
end
|
@@ -85,12 +85,12 @@ module Danger
|
|
85
85
|
raise "Subclass and overwrite organisation"
|
86
86
|
end
|
87
87
|
|
88
|
-
def file_url(_organisation: nil, _repository: nil, _branch:
|
88
|
+
def file_url(_organisation: nil, _repository: nil, _ref: nil, _branch: nil, _path: nil)
|
89
89
|
raise "Subclass and overwrite file_url"
|
90
90
|
end
|
91
|
-
|
92
|
-
def update_build_status(
|
93
|
-
|
91
|
+
|
92
|
+
def update_build_status(_status)
|
93
|
+
raise "Subclass and overwrite update_build_status"
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
1
|
require "danger/helpers/comments_helper"
|
4
2
|
require "danger/request_sources/vsts_api"
|
5
3
|
|
@@ -25,14 +23,13 @@ module Danger
|
|
25
23
|
def initialize(ci_source, environment)
|
26
24
|
self.ci_source = ci_source
|
27
25
|
|
28
|
-
@
|
26
|
+
@is_vsts_ci = environment.key? "DANGER_VSTS_HOST"
|
29
27
|
|
30
|
-
|
31
|
-
@api = VSTSAPI.new(project, slug, ci_source.pull_request_id, environment)
|
28
|
+
@api = VSTSAPI.new(ci_source.repo_slug, ci_source.pull_request_id, environment)
|
32
29
|
end
|
33
30
|
|
34
31
|
def validates_as_ci?
|
35
|
-
@
|
32
|
+
@is_vsts_ci
|
36
33
|
end
|
37
34
|
|
38
35
|
def validates_as_api_source?
|
@@ -132,6 +129,7 @@ module Danger
|
|
132
129
|
next unless comment_content.include?("generated_by_#{danger_id}")
|
133
130
|
# Skip the comment if it's an inline comment
|
134
131
|
next unless c[:threadContext].nil?
|
132
|
+
|
135
133
|
# Updated the danger posted comment
|
136
134
|
@api.update_comment(thread_id, comment_id, new_comment)
|
137
135
|
comment_updated = true
|
@@ -205,9 +203,9 @@ module Danger
|
|
205
203
|
|
206
204
|
matching_threads = danger_threads.select do |comment_data|
|
207
205
|
if comment_data.key?(:threadContext) && !comment_data[:threadContext].nil? &&
|
208
|
-
|
209
|
-
|
210
|
-
|
206
|
+
comment_data[:threadContext][:filePath] == m.file &&
|
207
|
+
comment_data[:threadContext].key?(:rightFileStart) &&
|
208
|
+
comment_data[:threadContext][:rightFileStart][:line] == m.line
|
211
209
|
# Parse it to avoid problems with strikethrough
|
212
210
|
violation = violations_from_table(comment_data[:comments].first[:content]).first
|
213
211
|
if violation
|
@@ -257,6 +255,7 @@ module Danger
|
|
257
255
|
next 1 unless b.file && b.line
|
258
256
|
|
259
257
|
next a.line <=> b.line if a.file == b.file
|
258
|
+
|
260
259
|
next a.file <=> b.file
|
261
260
|
end
|
262
261
|
|
@@ -274,7 +273,6 @@ module Danger
|
|
274
273
|
accumulator.merge(group) { |_, old, fresh| old + fresh }
|
275
274
|
end
|
276
275
|
end
|
277
|
-
|
278
276
|
end
|
279
277
|
end
|
280
278
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# coding: utf-8
|
3
2
|
|
4
3
|
require "base64"
|
5
4
|
require "danger/helpers/comments_helper"
|
@@ -9,7 +8,7 @@ module Danger
|
|
9
8
|
class VSTSAPI
|
10
9
|
attr_accessor :host, :pr_api_endpoint, :min_api_version_for_comments
|
11
10
|
|
12
|
-
def initialize(
|
11
|
+
def initialize(slug, pull_request_id, environment)
|
13
12
|
self.min_api_version_for_comments = "3.0"
|
14
13
|
|
15
14
|
user_name = ""
|
@@ -45,6 +44,10 @@ module Danger
|
|
45
44
|
@token && !@token.empty?
|
46
45
|
end
|
47
46
|
|
47
|
+
def pull_request(*)
|
48
|
+
fetch_pr_json
|
49
|
+
end
|
50
|
+
|
48
51
|
def fetch_pr_json
|
49
52
|
uri = URI("#{pr_api_endpoint}?api-version=#{@api_version}")
|
50
53
|
fetch_json(uri)
|
data/lib/danger/version.rb
CHANGED
data/lib/danger.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: 9.
|
4
|
+
version: 9.2.0
|
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: 2023-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|
@@ -40,33 +40,33 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.9.2
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: colored2
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '1
|
48
|
+
version: '3.1'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '1
|
55
|
+
version: '3.1'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: cork
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '0.1'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '0.1'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: faraday
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 0.9.0
|
77
77
|
- - "<"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
79
|
+
version: '3.0'
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
version: 0.9.0
|
87
87
|
- - "<"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '3.0'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: faraday-http-cache
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,95 +102,95 @@ dependencies:
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '2.0'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
105
|
+
name: git
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '1.7'
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '1.7'
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
|
-
name: kramdown
|
119
|
+
name: kramdown
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '2.3'
|
125
125
|
type: :runtime
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '2.3'
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
|
-
name:
|
133
|
+
name: kramdown-parser-gfm
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '1.0'
|
139
139
|
type: :runtime
|
140
140
|
prerelease: false
|
141
141
|
version_requirements: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '1.0'
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
|
-
name:
|
147
|
+
name: no_proxy_fix
|
148
148
|
requirement: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
153
|
-
- - "<"
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: '4'
|
152
|
+
version: '0'
|
156
153
|
type: :runtime
|
157
154
|
prerelease: false
|
158
155
|
version_requirements: !ruby/object:Gem::Requirement
|
159
156
|
requirements:
|
160
157
|
- - ">="
|
161
158
|
- !ruby/object:Gem::Version
|
162
|
-
version: '
|
163
|
-
- - "<"
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '4'
|
159
|
+
version: '0'
|
166
160
|
- !ruby/object:Gem::Dependency
|
167
|
-
name:
|
161
|
+
name: octokit
|
168
162
|
requirement: !ruby/object:Gem::Requirement
|
169
163
|
requirements:
|
170
164
|
- - "~>"
|
171
165
|
- !ruby/object:Gem::Version
|
172
|
-
version: '0
|
166
|
+
version: '5.0'
|
173
167
|
type: :runtime
|
174
168
|
prerelease: false
|
175
169
|
version_requirements: !ruby/object:Gem::Requirement
|
176
170
|
requirements:
|
177
171
|
- - "~>"
|
178
172
|
- !ruby/object:Gem::Version
|
179
|
-
version: '0
|
173
|
+
version: '5.0'
|
180
174
|
- !ruby/object:Gem::Dependency
|
181
|
-
name:
|
175
|
+
name: terminal-table
|
182
176
|
requirement: !ruby/object:Gem::Requirement
|
183
177
|
requirements:
|
184
178
|
- - ">="
|
185
179
|
- !ruby/object:Gem::Version
|
186
|
-
version: '
|
180
|
+
version: '1'
|
181
|
+
- - "<"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '4'
|
187
184
|
type: :runtime
|
188
185
|
prerelease: false
|
189
186
|
version_requirements: !ruby/object:Gem::Requirement
|
190
187
|
requirements:
|
191
188
|
- - ">="
|
192
189
|
- !ruby/object:Gem::Version
|
193
|
-
version: '
|
190
|
+
version: '1'
|
191
|
+
- - "<"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '4'
|
194
194
|
description: Stop Saying 'You Forgot To…' in Code Review
|
195
195
|
email:
|
196
196
|
- orta.therox@gmail.com
|
@@ -244,7 +244,6 @@ files:
|
|
244
244
|
- lib/danger/ci_source/surf.rb
|
245
245
|
- lib/danger/ci_source/teamcity.rb
|
246
246
|
- lib/danger/ci_source/travis.rb
|
247
|
-
- lib/danger/ci_source/vsts.rb
|
248
247
|
- lib/danger/ci_source/xcode_cloud.rb
|
249
248
|
- lib/danger/ci_source/xcode_server.rb
|
250
249
|
- lib/danger/clients/rubygems_client.rb
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require "danger/request_sources/github/github"
|
2
|
-
require "danger/request_sources/vsts"
|
3
|
-
|
4
|
-
module Danger
|
5
|
-
# ### CI Setup
|
6
|
-
#
|
7
|
-
# You need to go to your project's build definition. Then add a "Command Line" Task with the "Tool" field set to "bundle"
|
8
|
-
# and the "Arguments" field set to "exec danger".
|
9
|
-
#
|
10
|
-
# ### Token Setup
|
11
|
-
#
|
12
|
-
# #### GitHub
|
13
|
-
#
|
14
|
-
# You need to add the `DANGER_GITHUB_API_TOKEN` environment variable, to do this, go to your build definition's variables tab.
|
15
|
-
#
|
16
|
-
# Make sure that `DANGER_GITHUB_API_TOKEN` is not set to secret since vsts does not expose secret variables while building.
|
17
|
-
#
|
18
|
-
# #### VSTS
|
19
|
-
#
|
20
|
-
# You need to add the `DANGER_VSTS_API_TOKEN` and `DANGER_VSTS_HOST` environment variable, to do this,
|
21
|
-
# go to your build definition's variables tab. The `DANGER_VSTS_API_TOKEN` is your vsts personal access token.
|
22
|
-
# Instructions for creating a personal access token can be found [here](https://www.visualstudio.com/en-us/docs/setup-admin/team-services/use-personal-access-tokens-to-authenticate).
|
23
|
-
# For the `DANGER_VSTS_HOST` variable the suggested value is `$(System.TeamFoundationCollectionUri)$(System.TeamProject)`
|
24
|
-
# which will automatically get your vsts domain and your project name needed for the vsts api.
|
25
|
-
#
|
26
|
-
# Make sure that `DANGER_VSTS_API_TOKEN` is not set to secret since vsts does not expose secret variables while building.
|
27
|
-
#
|
28
|
-
class VSTS < CI
|
29
|
-
class << self
|
30
|
-
def github_slug(env)
|
31
|
-
env["BUILD_REPOSITORY_NAME"]
|
32
|
-
end
|
33
|
-
|
34
|
-
def vsts_slug(env)
|
35
|
-
project_name = env["SYSTEM_TEAMPROJECT"]
|
36
|
-
repo_name = env["BUILD_REPOSITORY_NAME"]
|
37
|
-
|
38
|
-
"#{project_name}/#{repo_name}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.validates_as_ci?(env)
|
43
|
-
has_all_variables = ["SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", "BUILD_REPOSITORY_PROVIDER"].all? { |x| env[x] && !env[x].empty? }
|
44
|
-
|
45
|
-
is_support_source_control = ["GitHub", "TfsGit"].include?(env["BUILD_REPOSITORY_PROVIDER"])
|
46
|
-
|
47
|
-
has_all_variables && is_support_source_control
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.validates_as_pr?(env)
|
51
|
-
has_all_variables = ["BUILD_SOURCEBRANCH", "BUILD_REPOSITORY_URI", "BUILD_REASON", "BUILD_REPOSITORY_NAME"].all? { |x| env[x] && !env[x].empty? }
|
52
|
-
|
53
|
-
has_all_variables && env["BUILD_REASON"] == "PullRequest"
|
54
|
-
end
|
55
|
-
|
56
|
-
def supported_request_sources
|
57
|
-
@supported_request_sources ||= [Danger::RequestSources::GitHub, Danger::RequestSources::VSTS]
|
58
|
-
end
|
59
|
-
|
60
|
-
def initialize(env)
|
61
|
-
case env["BUILD_REPOSITORY_PROVIDER"]
|
62
|
-
when "GitHub"
|
63
|
-
self.repo_slug = self.class.github_slug(env)
|
64
|
-
when "TfsGit"
|
65
|
-
self.repo_slug = self.class.vsts_slug(env)
|
66
|
-
end
|
67
|
-
|
68
|
-
repo_matches = env["BUILD_SOURCEBRANCH"].match(%r{refs\/pull\/([0-9]+)\/merge})
|
69
|
-
self.pull_request_id = repo_matches[1] unless repo_matches.nil?
|
70
|
-
self.repo_url = env["BUILD_REPOSITORY_URI"]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|