dependabot-cargo 0.201.1 → 0.204.0

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: 50b569d19b39989dcbd9bd0bb87ab5487c5e60ccbacae27b815b579e0dcd5310
4
- data.tar.gz: a0b1f0bad7a036b0f1f4060bf634605c5c3da240712f3ff119d2c5383ed72aea
3
+ metadata.gz: 2c316667a86f0549971f8b65c79280f33a78397b87a40503bf6d66f0faa2fbde
4
+ data.tar.gz: 27c9226a6f36df466e0b2e320e9a22a74187010d73c266c20bc31f6a5d69a8e5
5
5
  SHA512:
6
- metadata.gz: a5162f82fb1e9ef57a98a4901d6f3f991dc1604cae708534b86d8a9a5dcd1ab9cf2041b2be7e242c8744311cf714b25fa40f7621cf4f78d0caac281050cce8dc
7
- data.tar.gz: '079559eb51ba364d43e7110d3fde5a6ae0ae9c9f41f34b450216b31ba8054a587c8b7664157de4707be7e3f67df5fe8cc4cf903a214f50dc8b66ee8b26df0d85'
6
+ metadata.gz: fef84183b2b8aa896e50a9225a5a21688b98b0d093f3fda8ced4ce56ff9b2546769e5fb47cd3c8939d7dc5cbaf8be0734d9ea9abab8322e273e9058b88b0f058
7
+ data.tar.gz: 32d58bbb5d2ce798fd751407656bf1428e781bb0bfb743c9d772e67e4308b67097eb41155a6cbeb7a93263710361f6845a8de42c946d17a1137ea818bfdc0006
@@ -3,7 +3,7 @@
3
3
  require "excon"
4
4
  require "dependabot/metadata_finders"
5
5
  require "dependabot/metadata_finders/base"
6
- require "dependabot/shared_helpers"
6
+ require "dependabot/registry_client"
7
7
 
8
8
  module Dependabot
9
9
  module Cargo
@@ -50,12 +50,7 @@ module Dependabot
50
50
  def crates_listing
51
51
  return @crates_listing unless @crates_listing.nil?
52
52
 
53
- response = Excon.get(
54
- "https://crates.io/api/v1/crates/#{dependency.name}",
55
- idempotent: true,
56
- **SharedHelpers.excon_defaults
57
- )
58
-
53
+ response = Dependabot::RegistryClient.get(url: "https://crates.io/api/v1/crates/#{dependency.name}")
59
54
  @crates_listing = JSON.parse(response.body)
60
55
  end
61
56
  end
@@ -3,6 +3,7 @@
3
3
  require "excon"
4
4
  require "dependabot/cargo/update_checker"
5
5
  require "dependabot/update_checkers/version_filters"
6
+ require "dependabot/registry_client"
6
7
 
7
8
  module Dependabot
8
9
  module Cargo
@@ -83,12 +84,7 @@ module Dependabot
83
84
  def crates_listing
84
85
  return @crates_listing unless @crates_listing.nil?
85
86
 
86
- response = Excon.get(
87
- "https://crates.io/api/v1/crates/#{dependency.name}",
88
- idempotent: true,
89
- **SharedHelpers.excon_defaults
90
- )
91
-
87
+ response = Dependabot::RegistryClient.get(url: "https://crates.io/api/v1/crates/#{dependency.name}")
92
88
  @crates_listing = JSON.parse(response.body)
93
89
  end
94
90
 
@@ -19,6 +19,7 @@ module Dependabot
19
19
  OBJECT_PATTERN = /object not found - no match for id \(.*\)/.freeze
20
20
  REF_NOT_FOUND_REGEX =
21
21
  /#{UNABLE_TO_UPDATE}.*(#{REVSPEC_PATTERN}|#{OBJECT_PATTERN})/m.freeze
22
+ GIT_REF_NOT_FOUND_REGEX = /Updating git repository `(?<url>[^`]*)`.*fatal: couldn't find remote ref/m.freeze
22
23
 
23
24
  def initialize(dependency:, credentials:,
24
25
  original_dependency_files:, prepared_dependency_files:)
@@ -179,7 +180,6 @@ module Dependabot
179
180
 
180
181
  # rubocop:disable Metrics/AbcSize
181
182
  # rubocop:disable Metrics/PerceivedComplexity
182
- # rubocop:disable Metrics/MethodLength
183
183
  def handle_cargo_errors(error)
184
184
  if error.message.include?("does not have these features")
185
185
  # TODO: Ideally we should update the declaration not to ask
@@ -188,7 +188,8 @@ module Dependabot
188
188
  end
189
189
 
190
190
  if error.message.include?("authenticate when downloading repo") ||
191
- error.message.include?("HTTP 200 response: got 401")
191
+ error.message.include?("HTTP 200 response: got 401") ||
192
+ error.message.include?("fatal: Authentication failed for")
192
193
  # Check all dependencies for reachability (so that we raise a
193
194
  # consistent error)
194
195
  urls = unreachable_git_urls
@@ -204,17 +205,10 @@ module Dependabot
204
205
  raise Dependabot::GitDependenciesNotReachable, urls
205
206
  end
206
207
 
207
- if error.message.match?(BRANCH_NOT_FOUND_REGEX)
208
- dependency_url =
209
- error.message.match(BRANCH_NOT_FOUND_REGEX).
210
- named_captures.fetch("url").split(/[#?]/).first
211
- raise Dependabot::GitDependencyReferenceNotFound, dependency_url
212
- end
208
+ [BRANCH_NOT_FOUND_REGEX, REF_NOT_FOUND_REGEX, GIT_REF_NOT_FOUND_REGEX].each do |regex|
209
+ next unless error.message.match?(regex)
213
210
 
214
- if error.message.match?(REF_NOT_FOUND_REGEX)
215
- dependency_url =
216
- error.message.match(REF_NOT_FOUND_REGEX).
217
- named_captures.fetch("url").split(/[#?]/).first
211
+ dependency_url = error.message.match(regex).named_captures.fetch("url").split(/[#?]/).first
218
212
  raise Dependabot::GitDependencyReferenceNotFound, dependency_url
219
213
  end
220
214
 
@@ -245,7 +239,6 @@ module Dependabot
245
239
  end
246
240
  # rubocop:enable Metrics/AbcSize
247
241
  # rubocop:enable Metrics/PerceivedComplexity
248
- # rubocop:enable Metrics/MethodLength
249
242
 
250
243
  def unreachable_git_urls
251
244
  return @unreachable_git_urls if defined?(@unreachable_git_urls)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-cargo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.201.1
4
+ version: 0.204.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-25 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.201.1
19
+ version: 0.204.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.201.1
26
+ version: 0.204.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debase
29
29
  requirement: !ruby/object:Gem::Requirement