dependabot-common 0.113.18 → 0.113.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 830722a433e1fc99d28ef9d6812343b005f7bd6a44fe9a1a8ad49555c702b8a8
4
- data.tar.gz: c1728259c6296e643867d59a964d83e5bf0836457be53c0702094aae48e91960
3
+ metadata.gz: 7de0ce549409706f4b15e715b2f4ca45835ff7bc1fda5725f03bc56e899cf2ab
4
+ data.tar.gz: 2525710695a42e8f1d156630d9a242dac2cda7898513c0e1d836a11b8923c390
5
5
  SHA512:
6
- metadata.gz: dadbc442fc278cb7357eea381e4b874659bce5fd599b5a6480bc0959ec2c51ffca51c10d7cb84ce64cfd2b1f588856ad4284061e89d961f0e91c5e0755e901e2
7
- data.tar.gz: 00c92be989b8ce57f718c68c7d2650cc566993c7f75421f97f83e3470692148f910bf837bc10ab51d45d6cd14825b2cd46eea65ed306d16159cd2c47231ff043
6
+ metadata.gz: b309a3f226e4a3e6a59e899a62b31a7f0561c493749f6494a1a842f877d457af3e1c47c81ee70e20ea3c0a819b2fa4c5c828d6776379a40902560383dc8b991d
7
+ data.tar.gz: c3e3d9bd37881b1d9d83884dfb13ec67edea5186b2b0f9b5c5711eb10a27343f3dcc5c7ad2d2d47e8eebb4053ea4ac84aeb805ecb873751cc81c0bca3401032f
@@ -157,8 +157,8 @@ module Dependabot
157
157
  gitlab_client_for_source.edit_merge_request_approvers(
158
158
  source.repo,
159
159
  merge_request.iid,
160
- approver_ids: approvers_hash[:approvers] || [],
161
- approver_group_ids: approvers_hash[:group_approvers] || []
160
+ approver_ids: approvers_hash[:approvers],
161
+ approver_group_ids: approvers_hash[:group_approvers]
162
162
  )
163
163
  end
164
164
 
@@ -25,12 +25,7 @@ module Dependabot
25
25
  # (?:.|\n)*? Non-capturing group to consume code span content (non-eager)
26
26
  # (?>\k<codespanopen>) Atomic group marking the end of the code span (same length as opening)
27
27
  # rubocop:enable Metrics/LineLength
28
- CODEBLOCK_REGEX = /
29
- # fenced code block
30
- (?<=\n|^)(?<fenceopen>(?>`{3,}|~{3,})).*?(?>\k<fenceopen>)|
31
- # code span
32
- (?<codespanopen>`+)(?![^`]*?\n{2,})(?:.|\n)*?(?>\k<codespanopen>)
33
- /xm.freeze
28
+ CODEBLOCK_REGEX = /```|~~~/.freeze
34
29
  # End of string
35
30
  EOS_REGEX = /\z/.freeze
36
31
 
@@ -43,34 +38,23 @@ module Dependabot
43
38
  def sanitize_links_and_mentions(text:)
44
39
  # We don't want to sanitize any links or mentions that are contained
45
40
  # within code blocks, so we split the text on "```" or "~~~"
46
- sanitized_text = []
41
+ lines = []
47
42
  scan = StringScanner.new(text)
48
43
  until scan.eos?
49
- block = scan.scan_until(CODEBLOCK_REGEX) ||
50
- scan.scan_until(EOS_REGEX)
51
- sanitized_text << sanitize_links_and_mentions_in_block(block)
44
+ line = scan.scan_until(CODEBLOCK_REGEX) ||
45
+ scan.scan_until(EOS_REGEX)
46
+ delimiter = line.match(CODEBLOCK_REGEX)&.to_s
47
+ unless delimiter && lines.count { |l| l.include?(delimiter) }.odd?
48
+ line = sanitize_mentions(line)
49
+ line = sanitize_links(line)
50
+ end
51
+ lines << line
52
52
  end
53
- sanitized_text.join
53
+ lines.join
54
54
  end
55
55
 
56
56
  private
57
57
 
58
- def sanitize_links_and_mentions_in_block(block)
59
- # Handle code blocks one by one
60
- normal_text = block
61
- verbatim_text = ""
62
- match = block.match(CODEBLOCK_REGEX)
63
- if match
64
- # Part leading up to start of code block
65
- normal_text = match.pre_match
66
- # Entire code block copied verbatim
67
- verbatim_text = match.to_s
68
- end
69
- normal_text = sanitize_mentions(normal_text)
70
- normal_text = sanitize_links(normal_text)
71
- normal_text + verbatim_text
72
- end
73
-
74
58
  def sanitize_mentions(text)
75
59
  text.gsub(%r{(?<![A-Za-z0-9`~])@#{GITHUB_USERNAME}/?}) do |mention|
76
60
  next mention if mention.end_with?("/")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.113.18"
4
+ VERSION = "0.113.19"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.113.18
4
+ version: 0.113.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-30 00:00:00.000000000 Z
11
+ date: 2019-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit