dependabot-common 0.265.0 → 0.266.0

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: 4715cad47e5311ab6deb63b425cb37b8e9ad44266d20154ada92f5eebeb1072a
4
- data.tar.gz: 4194a3c0d440f8d320cfad7789f2e0237871236e0d39da5dc8b8705608c6176f
3
+ metadata.gz: cd4978cb1971e267084db00cc1d4d4a69a0ffffa5337bd8d61039ba8240f537a
4
+ data.tar.gz: d3b2ff619afff82aade103995ff62c8e5e1111834dd186acf328071a325c4362
5
5
  SHA512:
6
- metadata.gz: d86205634fc7375b9b652137782d4686c4763c278456ce52cd5af6d2778aa19540e4be8fa0203770234264e8e6af15105fffc428d4c5b160b94d6b1719b50a4f
7
- data.tar.gz: f3db0f9d9fd293ae3904812b81ec15f400a6b16973e4327f6c23556b27ce35bc767821693a4c6f105ed49b2d316546c906d586f9955e55ffcf8301b20720967e
6
+ metadata.gz: 8d90fcd1793af90f3552a542e6176ed06d55612a40680ca30c16e1e3c508d8025ca2b162840433027d99c9946cae89e19c2637141757c58b3138a4ad053fb7e7
7
+ data.tar.gz: e9ce0c2eb12245518865405046cf403696b3acae3953936a5a93650f390396a70f5208727f0dd93ba385ae35353d0170e3ba9c05bacbee33b0539473df03a837
@@ -142,7 +142,7 @@ module Dependabot
142
142
  next_page_url = base_url + pr_path
143
143
  pull_requests = paginate({ "next" => next_page_url })
144
144
 
145
- pull_requests unless source_branch && target_branch
145
+ pull_requests unless source_branch && target_branch # rubocop:disable Lint/Void
146
146
 
147
147
  pull_requests.select do |pr|
148
148
  if source_branch.nil?
@@ -159,6 +159,8 @@ module Dependabot
159
159
  end
160
160
  end
161
161
 
162
+ # rubocop:disable Lint/RedundantCopDisableDirective
163
+ # rubocop:disable Metrics/CyclomaticComplexity
162
164
  sig { params(error: StandardError).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
163
165
  def self.updater_error_details(error)
164
166
  case error
@@ -223,6 +225,11 @@ module Dependabot
223
225
  "go-mod": error.go_mod
224
226
  }
225
227
  }
228
+ when
229
+ IncompatibleCPU,
230
+ NetworkUnsafeHTTP
231
+ error.detail
232
+
226
233
  when Dependabot::NotImplemented
227
234
  {
228
235
  "error-type": "not_implemented",
@@ -230,6 +237,11 @@ module Dependabot
230
237
  message: error.message
231
238
  }
232
239
  }
240
+ when Dependabot::InvalidGitAuthToken
241
+ {
242
+ "error-type": "git_token_auth_error",
243
+ "error-detail": { message: error.message }
244
+ }
233
245
  when *Octokit::RATE_LIMITED_ERRORS
234
246
  # If we get a rate-limited error we let dependabot-api handle the
235
247
  # retry by re-enqueing the update job after the reset
@@ -242,6 +254,8 @@ module Dependabot
242
254
  end
243
255
  end
244
256
  # rubocop:enable Metrics/MethodLength
257
+ # rubocop:enable Metrics/CyclomaticComplexity
258
+ # rubocop:enable Lint/RedundantCopDisableDirective
245
259
 
246
260
  class DependabotError < StandardError
247
261
  extend T::Sig
@@ -294,12 +308,38 @@ module Dependabot
294
308
  end
295
309
  end
296
310
 
311
+ class TypedDependabotError < Dependabot::DependabotError
312
+ extend T::Sig
313
+
314
+ sig { returns(String) }
315
+ attr_reader :error_type
316
+
317
+ sig { params(error_type: String, message: T.any(T.nilable(String), MatchData)).void }
318
+ def initialize(error_type, message = nil)
319
+ @error_type = T.let(error_type, String)
320
+
321
+ super(message || error_type)
322
+ end
323
+
324
+ sig { params(hash: T.nilable(T::Hash[Symbol, T.untyped])).returns(T::Hash[Symbol, T.untyped]) }
325
+ def detail(hash = nil)
326
+ {
327
+ "error-type": error_type,
328
+ "error-detail": hash || {
329
+ message: message
330
+ }
331
+ }
332
+ end
333
+ end
334
+
297
335
  class OutOfDisk < DependabotError; end
298
336
 
299
337
  class OutOfMemory < DependabotError; end
300
338
 
301
339
  class NotImplemented < DependabotError; end
302
340
 
341
+ class InvalidGitAuthToken < DependabotError; end
342
+
303
343
  #####################
304
344
  # Repo level errors #
305
345
  #####################
@@ -531,6 +571,20 @@ module Dependabot
531
571
  end
532
572
  end
533
573
 
574
+ class InvalidGitAuthToken < DependabotError
575
+ extend T::Sig
576
+
577
+ sig { returns(String) }
578
+ attr_reader :source
579
+
580
+ sig { params(source: String).void }
581
+ def initialize(source)
582
+ @source = T.let(sanitize_source(source), String)
583
+ msg = "Missing or invalid authentication token while accessing github package : #{@source}"
584
+ super(msg)
585
+ end
586
+ end
587
+
534
588
  # Useful for JS file updaters, where the registry API sometimes returns
535
589
  # different results to the actual update process
536
590
  class InconsistentRegistryResponse < DependabotError; end
@@ -617,4 +671,18 @@ module Dependabot
617
671
 
618
672
  # Raised by FileParser if processing may execute external code in the update context
619
673
  class UnexpectedExternalCode < DependabotError; end
674
+
675
+ class IncompatibleCPU < TypedDependabotError
676
+ sig { params(message: T.any(T.nilable(String), MatchData)).void }
677
+ def initialize(message = nil)
678
+ super("incompatible_cpu", message)
679
+ end
680
+ end
681
+
682
+ class NetworkUnsafeHTTP < TypedDependabotError
683
+ sig { params(message: T.any(T.nilable(String), MatchData)).void }
684
+ def initialize(message = nil)
685
+ super("network_unsafe_http", message)
686
+ end
687
+ end
620
688
  end
@@ -19,7 +19,7 @@ module Dependabot
19
19
 
20
20
  sig { params(path: T.any(Pathname, String)).void }
21
21
  def initialize(path)
22
- super(path)
22
+ super
23
23
  @initial_head_sha = T.let(head_sha, String)
24
24
  configure_git
25
25
  end
data/lib/dependabot.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Dependabot
5
- VERSION = "0.265.0"
5
+ VERSION = "0.266.0"
6
6
  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.265.0
4
+ version: 0.266.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-11 00:00:00.000000000 Z
11
+ date: 2024-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit
@@ -382,14 +382,14 @@ dependencies:
382
382
  requirements:
383
383
  - - "~>"
384
384
  - !ruby/object:Gem::Version
385
- version: 1.63.2
385
+ version: 1.65.0
386
386
  type: :development
387
387
  prerelease: false
388
388
  version_requirements: !ruby/object:Gem::Requirement
389
389
  requirements:
390
390
  - - "~>"
391
391
  - !ruby/object:Gem::Version
392
- version: 1.63.2
392
+ version: 1.65.0
393
393
  - !ruby/object:Gem::Dependency
394
394
  name: rubocop-performance
395
395
  requirement: !ruby/object:Gem::Requirement
@@ -597,7 +597,7 @@ licenses:
597
597
  - MIT
598
598
  metadata:
599
599
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
600
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.265.0
600
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.266.0
601
601
  post_install_message:
602
602
  rdoc_options: []
603
603
  require_paths: