dependabot-common 0.113.5 → 0.113.10

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: 95e256e79a2e6e9c69478b3376219b4a6b27e4a2ec1671f2691832f442a9c242
4
- data.tar.gz: 0c96f62c27f3b417f43535eaf171bffe84d1e1572a26ba839c314e0803239b94
3
+ metadata.gz: d600a59386c6492eb9411615427693b6b15278a0a03ada2c0858cdb9492ba4a2
4
+ data.tar.gz: ab5c208f0e2c706d2a19c33a2950b409f8fbb843bc54725c22a22be909b10700
5
5
  SHA512:
6
- metadata.gz: 15ba9bcb6be0042e8f9054b79a27aa14abd64d0c36f0c449d3c1e46c5d46bbfea6908e668232c61bf9939a0a3e4102bef597d4b94a5f2c63b1bd70ef881b874e
7
- data.tar.gz: e575e120631013b83ba68eeca53a86ff9d44f7758a9c924b8d517993579c4ff6c59cbb2913026b17cc03de07ed068003c16148d37eed392420ab269b4446f2da
6
+ metadata.gz: 866c909e0f9217a229230b42de9012cb3e8f4bc12cca87aba57fe5c91412086065ae4fdc0bcb85494eb3292d4148661cebbf5ef7f1677c652b445ff2fdd97dd6
7
+ data.tar.gz: b0903cb5206f5eca16250d4b3d6a18cee962ba2487b2dbd640176a48320150f86435686d111ad332692ba448a67532fb2031df872bdeb43f8c457f551fc67f2b
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "strscan"
3
4
  require "dependabot/pull_request_creator/message_builder"
4
5
 
5
6
  module Dependabot
@@ -12,18 +13,9 @@ module Dependabot
12
13
  github\.com/(?<repo>#{GITHUB_USERNAME}/[^/\s]+)/
13
14
  (?:issue|pull)s?/(?<number>\d+)
14
15
  }x.freeze
15
-
16
- # Note that we're being deliberately careful about not matching
17
- # different length strings of what look like code block quotes. By
18
- # doing so we err on the side of sanitizing, which is *much* better
19
- # than accidentally not sanitizing.
20
- #
21
- # rubocop:disable Style/RegexpLiteral
22
- CODEBLOCK_REGEX = %r{
23
- (?=[\s]`{3}[^`])|(?=[\s]`{3}\Z)|(?=\A`{3}[^`])|
24
- (?=[\s]~{3}[^~])|(?=[\s]~{3}\Z)|(?=\A~{3}[^~])
25
- }x.freeze
26
- # rubocop:enable Style/RegexpLiteral
16
+ CODEBLOCK_REGEX = /```|~~~/.freeze
17
+ # End of string
18
+ EOS_REGEX = /\z/.freeze
27
19
 
28
20
  attr_reader :github_redirection_service
29
21
 
@@ -33,18 +25,20 @@ module Dependabot
33
25
 
34
26
  def sanitize_links_and_mentions(text:)
35
27
  # We don't want to sanitize any links or mentions that are contained
36
- # within code blocks, so we split the text on "```"
37
- snippets = text.split(CODEBLOCK_REGEX)
38
- if snippets.first&.start_with?(CODEBLOCK_REGEX)
39
- snippets = ["", *snippets]
28
+ # within code blocks, so we split the text on "```" or "~~~"
29
+ lines = []
30
+ scan = StringScanner.new(text)
31
+ until scan.eos?
32
+ line = scan.scan_until(CODEBLOCK_REGEX) ||
33
+ scan.scan_until(EOS_REGEX)
34
+ delimiter = line.match(CODEBLOCK_REGEX)&.to_s
35
+ unless delimiter && lines.count { |l| l.include?(delimiter) }.odd?
36
+ line = sanitize_mentions(line)
37
+ line = sanitize_links(line)
38
+ end
39
+ lines << line
40
40
  end
41
-
42
- snippets.map.with_index do |snippet, index|
43
- next snippet if index.odd?
44
-
45
- snippet = sanitize_mentions(snippet)
46
- sanitize_links(snippet)
47
- end.join
41
+ lines.join
48
42
  end
49
43
 
50
44
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.113.5"
4
+ VERSION = "0.113.10"
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.5
4
+ version: 0.113.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-30 00:00:00.000000000 Z
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit
@@ -230,14 +230,14 @@ dependencies:
230
230
  requirements:
231
231
  - - "~>"
232
232
  - !ruby/object:Gem::Version
233
- version: '12'
233
+ version: '13'
234
234
  type: :development
235
235
  prerelease: false
236
236
  version_requirements: !ruby/object:Gem::Requirement
237
237
  requirements:
238
238
  - - "~>"
239
239
  - !ruby/object:Gem::Version
240
- version: '12'
240
+ version: '13'
241
241
  - !ruby/object:Gem::Dependency
242
242
  name: rspec
243
243
  requirement: !ruby/object:Gem::Requirement
@@ -286,14 +286,14 @@ dependencies:
286
286
  requirements:
287
287
  - - "~>"
288
288
  - !ruby/object:Gem::Version
289
- version: 0.74.0
289
+ version: 0.75.0
290
290
  type: :development
291
291
  prerelease: false
292
292
  version_requirements: !ruby/object:Gem::Requirement
293
293
  requirements:
294
294
  - - "~>"
295
295
  - !ruby/object:Gem::Version
296
- version: 0.74.0
296
+ version: 0.75.0
297
297
  - !ruby/object:Gem::Dependency
298
298
  name: vcr
299
299
  requirement: !ruby/object:Gem::Requirement