dependabot-common 0.143.5 → 0.145.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: 519d829e63edf21602f5031e532dbccce99323676b624ff130e089b6f3ec44ef
4
- data.tar.gz: 3fb4986daa15f8d92a5af167473d3b32ed3132699fa4f2c85ebf2060632f55e7
3
+ metadata.gz: 8ac0eb6a686627e7b673437c5c1da1752c604c1d4efc639c10f20d45afc2476c
4
+ data.tar.gz: e723d56fac036d1ceaffc0c6bf80ea9dddca274de51ead1c97dd3a4c1ad9b429
5
5
  SHA512:
6
- metadata.gz: dd23c91a75da2f3a93719a031c42d259dee57c7b7f489a044c3480dee8cfb5f55a48a19a961a90064d6939710574d3ef0531755d685bbff7457475306969b16e
7
- data.tar.gz: c1b8bbdadea4755383f7585752d1bcedd1f875475e31b452ffb8e74578fac2152b250bf071840361bd958eb9240b5adcb0671e04a915fc2baf86b0297f382585
6
+ metadata.gz: 63058f60bf2d7f8697dcab17608f59dfccd5950cac1e68f61d44411d0854179e8de14508a77a885c29a6a06d4d7ac47d77d23772a476014b8400e78ad5c04f2e
7
+ data.tar.gz: b9e36648341f0b0afa36bc3106ef5c3e090243186831ca1f37400719d0da653eb366d30fd7deff1fa6c9ab20cb3a86d32758626e77f17b08e9e500e508de8b15
@@ -32,6 +32,8 @@ module Dependabot
32
32
  end
33
33
 
34
34
  def versions_by_type(dependency)
35
+ return [] unless dependency.version
36
+
35
37
  transformed_update_types.flat_map do |t|
36
38
  case t
37
39
  when PATCH_VERSION_TYPE
@@ -47,53 +49,44 @@ module Dependabot
47
49
  end
48
50
 
49
51
  def ignore_patch(version)
50
- parts = version.split(".")
51
- return [] unless parts.size > 2
52
+ return [] unless rubygems_compatible?(version)
52
53
 
53
- lower_parts = parts.first(2) + ["a"]
54
- upper_parts = parts.first(2)
55
- upper_parts[1] = upper_parts[1].to_i + 1
56
- lower_bound = ">= #{lower_parts.join('.')}"
54
+ parts = version.split(".")
55
+ version_parts = parts.fill(0, parts.length...2)
56
+ upper_parts = version_parts.first(1) + [version_parts[1].to_i + 1]
57
+ lower_bound = "> #{version}"
57
58
  upper_bound = "< #{upper_parts.join('.')}"
59
+
58
60
  ["#{lower_bound}, #{upper_bound}"]
59
61
  end
60
62
 
61
63
  def ignore_minor(version)
62
- parts = version.split(".")
63
- return [] if parts.size < 2
64
-
65
- if Gem::Version.correct?(version)
66
- lower_parts = parts.first(2) + ["a"]
67
- upper_parts = parts.first(1)
68
- lower_parts[1] = lower_parts[1].to_i + 1
69
- upper_parts[0] = upper_parts[0].to_i + 1
70
- else
71
- lower_parts = parts.first(1) + ["a"]
72
- upper_parts = parts.first(1)
73
- begin
74
- upper_parts[0] = Integer(upper_parts[0]) + 1
75
- rescue ArgumentError
76
- upper_parts.push(999_999)
77
- end
78
- end
64
+ return [] unless rubygems_compatible?(version)
79
65
 
66
+ parts = version.split(".")
67
+ version_parts = parts.fill(0, parts.length...2)
68
+ lower_parts = version_parts.first(1) + [version_parts[1].to_i + 1] + ["a"]
69
+ upper_parts = version_parts.first(0) + [version_parts[0].to_i + 1]
80
70
  lower_bound = ">= #{lower_parts.join('.')}"
81
71
  upper_bound = "< #{upper_parts.join('.')}"
72
+
82
73
  ["#{lower_bound}, #{upper_bound}"]
83
74
  end
84
75
 
85
76
  def ignore_major(version)
86
- parts = version.split(".")
87
- return [] unless parts.size > 1
77
+ return [] unless rubygems_compatible?(version)
88
78
 
89
- lower_parts = parts.first(1) + ["a"]
90
- upper_parts = parts.first(1)
91
- lower_parts[0] = lower_parts[0].to_i + 1
92
- upper_parts[0] = upper_parts[0].to_i + 2
79
+ version_parts = version.split(".")
80
+ lower_parts = [version_parts[0].to_i + 1] + ["a"]
93
81
  lower_bound = ">= #{lower_parts.join('.')}"
94
- upper_bound = "< #{upper_parts.join('.')}"
95
82
 
96
- ["#{lower_bound}, #{upper_bound}"]
83
+ [lower_bound]
84
+ end
85
+
86
+ def rubygems_compatible?(version)
87
+ return false if version.nil? || version.empty?
88
+
89
+ Gem::Version.correct?(version)
97
90
  end
98
91
  end
99
92
  end
@@ -14,7 +14,7 @@ module Dependabot
14
14
 
15
15
  def ignored_versions_for(dependency, security_updates_only: false)
16
16
  normalizer = name_normaliser_for(dependency)
17
- dep_name = name_normaliser_for(dependency).call(dependency.name)
17
+ dep_name = normalizer.call(dependency.name)
18
18
 
19
19
  @ignore_conditions.
20
20
  select { |ic| self.class.wildcard_match?(normalizer.call(ic.dependency_name), dep_name) }.
@@ -226,12 +226,12 @@ module Dependabot
226
226
  end
227
227
 
228
228
  def create_branch(commit)
229
- ref = "heads/#{branch_name}"
229
+ ref = "refs/heads/#{branch_name}"
230
230
 
231
231
  begin
232
232
  branch =
233
233
  github_client_for_source.create_ref(source.repo, ref, commit.sha)
234
- @branch_name = ref.gsub(%r{^heads/}, "")
234
+ @branch_name = ref.gsub(%r{^refs/heads/}, "")
235
235
  branch
236
236
  rescue Octokit::UnprocessableEntity => e
237
237
  # Return quietly in the case of a race
@@ -244,7 +244,7 @@ module Dependabot
244
244
 
245
245
  # Branch creation will fail if a branch called `dependabot` already
246
246
  # exists, since git won't be able to create a dir with the same name
247
- ref = "heads/#{SecureRandom.hex[0..3] + branch_name}"
247
+ ref = "refs/heads/#{SecureRandom.hex[0..3] + branch_name}"
248
248
  retry
249
249
  end
250
250
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.143.5"
4
+ VERSION = "0.145.2"
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.143.5
4
+ version: 0.145.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-29 00:00:00.000000000 Z
11
+ date: 2021-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -298,14 +298,14 @@ dependencies:
298
298
  requirements:
299
299
  - - "~>"
300
300
  - !ruby/object:Gem::Version
301
- version: 1.13.0
301
+ version: 1.14.0
302
302
  type: :development
303
303
  prerelease: false
304
304
  version_requirements: !ruby/object:Gem::Requirement
305
305
  requirements:
306
306
  - - "~>"
307
307
  - !ruby/object:Gem::Version
308
- version: 1.13.0
308
+ version: 1.14.0
309
309
  - !ruby/object:Gem::Dependency
310
310
  name: simplecov
311
311
  requirement: !ruby/object:Gem::Requirement