diff --git a/bundler/lib/dependabot/bundler/metadata_finder.rb b/bundler/lib/dependabot/bundler/metadata_finder.rb index e8ac8d29f7..123b0a8caa 100644 --- a/bundler/lib/dependabot/bundler/metadata_finder.rb +++ b/bundler/lib/dependabot/bundler/metadata_finder.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true require "excon" @@ -87,7 +87,7 @@ def find_source_from_gemspec_download end source_url = github_urls.find do |url| - repo = Source.from_url(url).repo + repo = T.must(Source.from_url(url)).repo repo.downcase.end_with?(dependency.name) end return unless source_url @@ -102,7 +102,7 @@ def changelog_url_from_gemspec_download rubygems_marshalled_gemspec_response.gsub("\x06;", "\n") .scan(Dependabot::Source::SOURCE_REGEX) do github_urls << (Regexp.last_match.to_s + - Regexp.last_match.post_match.split("\n").first) + T.must(T.must(Regexp.last_match).post_match.split("\n").first)) end github_urls.find do |url| @@ -204,7 +204,7 @@ def base_url cred["type"] == "rubygems_server" && cred.replaces_base? end host = credential ? credential["host"] : "rubygems.org" - @base_url = "https://#{host}" + ("/" unless host.end_with?("/")) + @base_url = "https://#{host}#{host&.end_with?('/') ? '' : '/'}" end def registry_auth_headers