dependabot-common 0.143.4 → 0.145.1

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: b77a9d2b68d327cac78394acd6c7452e0f802512434ee5fe38b62cde2e2e8393
4
- data.tar.gz: 4b532ba4ddd784f4adb93977bd34c28bdfd54ae1f8f5500ad9b3179febd1db17
3
+ metadata.gz: a80e631b98e75278c5ffc5528636e856a16a6b683e9c069ec86dfdf6c27884c9
4
+ data.tar.gz: 9626f4499aa5757d6145922a7fa9a8990fdb029f332744fd5b4d3aa7547e0feb
5
5
  SHA512:
6
- metadata.gz: 922b4ae93a6beeffa8e1d11e5b6a5cb329fc7b833ae54e102a6a9dc944681df11ed32a3bdfe04e12b03e2ce96e6d0a5cf40476ba01958112206c93495a2fcd0e
7
- data.tar.gz: 504b7550c05fcd284c4b41107dd92dbb362666c3258dae96cc42477c50ae6eef12adaaa8e2c68cb9bf6f8cc6f274fdad8a0f28131777f29d069c715d52e24e32
6
+ metadata.gz: 3e974733619012f02b59f00ab83263141d39042238ba7ac3dc49ce513048e16277e2db16d6a22536e39e322d937f95892b2a40ff5ac17c970810c0aff210903a
7
+ data.tar.gz: 18b1cb50a00aabb33fe82261bdf657fcd976e47fef9dd23206a83959dbaddd9534e4032fbb8ef711aae31db1e7c2dd7ef519e8c904451206dac88c2de278f2e5
@@ -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.4"
4
+ VERSION = "0.145.1"
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.4
4
+ version: 0.145.1
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-26 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport