Skip to content

Commit

Permalink
Strict type Dependabot::Hex::MixFileGitPinUpdater (#9983)
Browse files Browse the repository at this point in the history
* Strict type Dependabot::Hex::MixFileGitPinUpdater.

* Strict type Dependabot::Hex::MixFileGitPinUpdater.
  • Loading branch information
raj-meka authored Jun 12, 2024
1 parent 921fcff commit b783b3a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion hex/lib/dependabot/hex/file_updater/mixfile_git_pin_updater.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# typed: true
# typed: strong
# frozen_string_literal: true

require "dependabot/hex/file_updater"
require "dependabot/shared_helpers"
require "sorbet-runtime"

module Dependabot
module Hex
class FileUpdater
class MixfileGitPinUpdater
extend T::Sig

sig { params(dependency_name: String, mixfile_content: String, previous_pin: String, updated_pin: String).void }
def initialize(dependency_name:, mixfile_content:,
previous_pin:, updated_pin:)
@dependency_name = dependency_name
Expand All @@ -16,6 +20,7 @@ def initialize(dependency_name:, mixfile_content:,
@updated_pin = updated_pin
end

sig { returns(String) }
def updated_content
updated_content = update_pin(mixfile_content)

Expand All @@ -26,11 +31,19 @@ def updated_content

private

sig { returns(String) }
attr_reader :dependency_name

sig { returns(String) }
attr_reader :mixfile_content

sig { returns(String) }
attr_reader :previous_pin

sig { returns(String) }
attr_reader :updated_pin

sig { params(content: String).returns(String) }
def update_pin(content)
requirement_line_regex =
/
Expand All @@ -43,6 +56,7 @@ def update_pin(content)
end
end

sig { returns(T::Boolean) }
def content_should_change?
previous_pin == updated_pin
end
Expand Down

0 comments on commit b783b3a

Please sign in to comment.