From 142f767b4e566fc7999ea02fc6a7c8c49ec90472 Mon Sep 17 00:00:00 2001 From: Alfred Mazimbe Date: Thu, 28 Nov 2024 15:50:51 +0000 Subject: [PATCH] Remove inconsistent language requirement --- hex/lib/dependabot/hex/file_parser.rb | 11 +---------- hex/lib/dependabot/hex/language.rb | 6 +++--- hex/spec/dependabot/hex/file_parser_spec.rb | 4 ++-- hex/spec/dependabot/hex/language_spec.rb | 10 +--------- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/hex/lib/dependabot/hex/file_parser.rb b/hex/lib/dependabot/hex/file_parser.rb index 574fbd92fb..d39067d116 100644 --- a/hex/lib/dependabot/hex/file_parser.rb +++ b/hex/lib/dependabot/hex/file_parser.rb @@ -164,7 +164,7 @@ def package_manager sig { returns(T.nilable(Ecosystem::VersionManager)) } def language @language ||= T.let( - Language.new(elixir_version, nil), + Language.new(elixir_version), T.nilable(Dependabot::Hex::Language) ) end @@ -189,15 +189,6 @@ def hex_info } end, T.nilable(T::Hash[Symbol, T.nilable(String)])) end - - sig { returns(T.nilable(Dependabot::Hex::Requirement)) } - def language_requirement - command = "mix run --eval 'Mix.Project.config()[:elixir] |> IO.puts()'" - requirement = SharedHelpers.run_shell_command(command) - return if requirement.empty? || requirement.nil? - - Dependabot::Hex::Requirement.new(requirement) - end end end end diff --git a/hex/lib/dependabot/hex/language.rb b/hex/lib/dependabot/hex/language.rb index e5eea84127..b315e6ab61 100644 --- a/hex/lib/dependabot/hex/language.rb +++ b/hex/lib/dependabot/hex/language.rb @@ -12,9 +12,9 @@ module Hex class Language < Dependabot::Ecosystem::VersionManager extend T::Sig - sig { params(raw_version: String, requirement: T.nilable(Requirement)).void } - def initialize(raw_version, requirement = nil) - super(LANGUAGE, Version.new(raw_version), [], [], requirement) + sig { params(raw_version: String).void } + def initialize(raw_version) + super(LANGUAGE, Version.new(raw_version)) end end end diff --git a/hex/spec/dependabot/hex/file_parser_spec.rb b/hex/spec/dependabot/hex/file_parser_spec.rb index 38de1f66e0..bc5fca2d5e 100644 --- a/hex/spec/dependabot/hex/file_parser_spec.rb +++ b/hex/spec/dependabot/hex/file_parser_spec.rb @@ -466,7 +466,7 @@ it "returns the correct package manager" do expect(package_manager.name).to eq "hex" expect(package_manager.requirement).to be_nil - expect(package_manager.version.to_s).to eq "2.1.1" + expect(package_manager.version.to_s).to eq "2.0.6" end end @@ -476,7 +476,7 @@ it "returns the correct language" do expect(language.name).to eq "elixir" expect(language.requirement).to be_nil - expect(language.version.to_s).to eq "1.17.3" + expect(language.version.to_s).to eq "1.14.4" end end end diff --git a/hex/spec/dependabot/hex/language_spec.rb b/hex/spec/dependabot/hex/language_spec.rb index 36ee98e6ba..f4b7602c59 100644 --- a/hex/spec/dependabot/hex/language_spec.rb +++ b/hex/spec/dependabot/hex/language_spec.rb @@ -1,16 +1,14 @@ # typed: false # frozen_string_literal: true -require "dependabot/hex/requirement" require "dependabot/hex/language" require "dependabot/ecosystem" require "spec_helper" RSpec.describe Dependabot::Hex::Language do - subject(:language) { described_class.new(version, requirement) } + subject(:language) { described_class.new(version) } let(:version) { "1.17.3" } - let(:requirement) { Dependabot::Hex::Requirement.new("~> 1.5") } describe "#version" do it "returns the version" do @@ -24,12 +22,6 @@ end end - describe "#requirement" do - it "returns the requirement" do - expect(language.requirement).to eq(requirement) - end - end - describe "#unsupported?" do it "returns false by default" do expect(language.unsupported?).to be false