dependabot-elm 0.293.0 → 0.295.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: 2f3f6e172ba2693e54da806a2e75034903ccd983d102f18241639e333153c78d
4
- data.tar.gz: c759352362235631d5d3ca60d601775481a2280c082e0629ab67b1dba119912c
3
+ metadata.gz: 5d5254a5341f16a10d04f158336d165c2899627ceb1a243bafe31c03e2fccd84
4
+ data.tar.gz: e0e760efc94f75058e1edcd10cd457d67951005b5654688ed9adc5dd7562a71e
5
5
  SHA512:
6
- metadata.gz: b1a112471138896eaee61fac9aacc2df1ce58b2db19c247f388f32fe855f34d9522f5626ff4f00d767381f85ccd04e1a822a48299816e0eec9d76a7f36bd01f7
7
- data.tar.gz: 87e490e5aca3ac27716fd9e91918cb778b36187855cf58f4b84095e43eb1cf6f798d066b45c9e2e3f554cf13875e16bedaa5e3d2b111b578b058748ffe2e60c8
6
+ metadata.gz: 14182b3bea6dc61bec1e140ca2f1365b391bf1d0c5cf791966691b751e2a00e7d12d5bea180a14aa29c01fc9a07613f89614d59f3c5aa40b893825b5c78f7c5f
7
+ data.tar.gz: be4aae26a1d5705c0f26d547d9befb5c2bd14e2b03dfa3a2c4a1a24faad9c47c2a188d55fdffe3b729f972de31314943892b313004a64d3934c8644f1ff4e78d
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "dependabot/elm/file_updater"
@@ -7,11 +7,15 @@ module Dependabot
7
7
  module Elm
8
8
  class FileUpdater
9
9
  class ElmJsonUpdater
10
+ extend T::Sig
11
+
12
+ sig { params(elm_json_file: Dependabot::DependencyFile, dependencies: T::Array[Dependabot::Dependency]).void }
10
13
  def initialize(elm_json_file:, dependencies:)
11
14
  @elm_json_file = elm_json_file
12
15
  @dependencies = dependencies
13
16
  end
14
17
 
18
+ sig { returns(T.nilable(String)) }
15
19
  def updated_content
16
20
  dependencies
17
21
  .select { |dep| requirement_changed?(elm_json_file, dep) }
@@ -32,34 +36,33 @@ module Dependabot
32
36
 
33
37
  private
34
38
 
39
+ sig { returns(Dependabot::DependencyFile) }
35
40
  attr_reader :elm_json_file
41
+
42
+ sig { returns(T::Array[Dependabot::Dependency]) }
36
43
  attr_reader :dependencies
37
44
 
45
+ sig { params(file: Dependabot::DependencyFile, dependency: Dependabot::Dependency).returns(T::Boolean) }
38
46
  def requirement_changed?(file, dependency)
39
- changed_requirements =
40
- dependency.requirements - dependency.previous_requirements
47
+ changed_requirements = dependency.requirements - T.must(dependency.previous_requirements)
41
48
 
42
49
  changed_requirements.any? { |f| f[:file] == file.name }
43
50
  end
44
51
 
52
+ sig { params(content: T.nilable(String), filename: String, dependency: Dependabot::Dependency).returns(String) }
45
53
  def update_requirement(content:, filename:, dependency:)
46
- updated_req =
47
- dependency.requirements
48
- .find { |r| r.fetch(:file) == filename }
49
- .fetch(:requirement)
54
+ updated_req = dependency.requirements.find { |r| r.fetch(:file) == filename }
55
+ &.fetch(:requirement)
50
56
 
51
- old_req =
52
- dependency.previous_requirements
53
- .find { |r| r.fetch(:file) == filename }
54
- .fetch(:requirement)
57
+ old_req = dependency.previous_requirements&.find { |r| r.fetch(:file) == filename }
58
+ &.fetch(:requirement)
55
59
 
56
- return content unless old_req
60
+ return T.must(content) unless old_req
57
61
 
58
62
  dep = dependency
59
- regex =
60
- /"#{Regexp.quote(dep.name)}"\s*:\s+"#{Regexp.quote(old_req)}"/
63
+ regex = /"#{Regexp.quote(dep.name)}"\s*:\s+"#{Regexp.quote(old_req)}"/
61
64
 
62
- content.gsub(regex) do |declaration|
65
+ T.must(content).gsub(regex) do |declaration|
63
66
  declaration.gsub(%("#{old_req}"), %("#{updated_req}"))
64
67
  end
65
68
  end
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "dependabot/elm/version"
@@ -9,20 +9,28 @@ module Dependabot
9
9
  module Elm
10
10
  class UpdateChecker
11
11
  class RequirementsUpdater
12
+ extend T::Sig
12
13
  RANGE_REQUIREMENT_REGEX =
13
14
  /(\d+\.\d+\.\d+) <= v < (\d+\.\d+\.\d+)/
14
15
  SINGLE_VERSION_REGEX = /\A(\d+\.\d+\.\d+)\z/
15
16
 
17
+ sig do
18
+ params(requirements: T::Array[T::Hash[Symbol, T.nilable(String)]],
19
+ latest_resolvable_version: T.nilable(T.any(String, Integer, Dependabot::Version))).void
20
+ end
16
21
  def initialize(requirements:, latest_resolvable_version:)
17
- @requirements = requirements
22
+ @requirements = T.let(requirements, T::Array[T::Hash[Symbol, T.nilable(String)]])
18
23
 
19
24
  return unless latest_resolvable_version
20
25
  return unless version_class.correct?(latest_resolvable_version)
21
26
 
22
- @latest_resolvable_version =
23
- version_class.new(latest_resolvable_version)
27
+ @latest_resolvable_version = T.let(
28
+ version_class.new(latest_resolvable_version),
29
+ T.nilable(Dependabot::Version)
30
+ )
24
31
  end
25
32
 
33
+ sig { returns(T::Array[T::Hash[Symbol, T.nilable(String)]]) }
26
34
  def updated_requirements
27
35
  return requirements unless latest_resolvable_version
28
36
 
@@ -38,9 +46,12 @@ module Dependabot
38
46
 
39
47
  private
40
48
 
49
+ sig { returns(T::Array[T::Hash[Symbol, T.nilable(String)]]) }
41
50
  attr_reader :requirements
51
+ sig { returns(T.nilable(Dependabot::Version)) }
42
52
  attr_reader :latest_resolvable_version
43
53
 
54
+ sig { params(old_req: T.nilable(String), new_version: T.untyped).returns(String) }
44
55
  def update_requirement(old_req, new_version)
45
56
  if requirement_class.new(old_req).satisfied_by?(new_version)
46
57
  old_req
@@ -53,19 +64,23 @@ module Dependabot
53
64
  end
54
65
  end
55
66
 
67
+ sig { params(minimum: T.untyped, version: T.untyped).returns(String) }
56
68
  def require_range(minimum, version)
57
69
  major, _minor, _patch = version.to_s.split(".").map(&:to_i)
58
70
  "#{minimum} <= v < #{major + 1}.0.0"
59
71
  end
60
72
 
73
+ sig { params(version: Dependabot::Elm::Version).returns(String) }
61
74
  def require_exactly(version)
62
75
  "#{version} <= v <= #{version}"
63
76
  end
64
77
 
78
+ sig { returns(T.class_of(Dependabot::Elm::Version)) }
65
79
  def version_class
66
80
  Elm::Version
67
81
  end
68
82
 
83
+ sig { returns(T.class_of(Dependabot::Elm::Requirement)) }
69
84
  def requirement_class
70
85
  Elm::Requirement
71
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-elm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.293.0
4
+ version: 0.295.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-16 00:00:00.000000000 Z
11
+ date: 2025-01-30 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.293.0
19
+ version: 0.295.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.293.0
26
+ version: 0.295.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -261,7 +261,7 @@ licenses:
261
261
  - MIT
262
262
  metadata:
263
263
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
264
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.293.0
264
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.295.0
265
265
  post_install_message:
266
266
  rdoc_options: []
267
267
  require_paths: