Skip to content

Commit

Permalink
fix exceptions from integration tests due to no metadata finders (#9697)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakecoffman committed May 10, 2024
1 parent ac4d094 commit e8f477a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 2 deletions.
Expand Up @@ -297,6 +297,7 @@ def fetch_dependency_file_list(ref)
when "gitlab" then fetch_gitlab_file_list
when "azure" then fetch_azure_file_list
when "codecommit" then [] # TODO: Fetch Files from Codecommit
when "example" then []
else raise "Unexpected repo provider '#{T.must(source).provider}'"
end
end
Expand Down
Expand Up @@ -51,6 +51,7 @@ def commits_url
when "bitbucket" then bitbucket_compare_path(new_tag, previous_tag)
when "gitlab" then gitlab_compare_path(new_tag, previous_tag)
when "azure" then azure_compare_path(new_tag, previous_tag)
when "example" then ""
else raise "Unexpected source provider '#{T.must(source).provider}'"
end

Expand Down
Expand Up @@ -242,7 +242,7 @@ def fetch_dependency_releases
when "github" then fetch_github_releases
# Bitbucket and CodeCommit don't support releases and
# Azure can't list API for annotated tags
when "bitbucket", "azure", "codecommit" then []
when "bitbucket", "azure", "codecommit", "example" then []
when "gitlab" then fetch_gitlab_releases
else raise "Unexpected repo provider '#{T.must(source).provider}'"
end
Expand Down
Expand Up @@ -317,6 +317,7 @@ def recent_commit_messages
when "azure" then recent_azure_commit_messages
when "bitbucket" then recent_bitbucket_commit_messages
when "codecommit" then recent_codecommit_commit_messages
when "example" then []
else raise "Unsupported provider: #{source.provider}"
end
end
Expand Down Expand Up @@ -402,6 +403,7 @@ def last_dependabot_commit_message
when "azure" then last_azure_dependabot_commit_message
when "bitbucket" then last_bitbucket_dependabot_commit_message
when "codecommit" then last_codecommit_dependabot_commit_message
when "example" then nil
else raise "Unsupported provider: #{source.provider}"
end,
T.nilable(String)
Expand Down
4 changes: 3 additions & 1 deletion silent/lib/dependabot/silent.rb
Expand Up @@ -7,7 +7,7 @@
require "dependabot/silent/file_parser"
require "dependabot/silent/update_checker"
require "dependabot/silent/file_updater"
# require "dependabot/silent/metadata_finder" TODO
require "dependabot/silent/metadata_finder"
require "dependabot/silent/requirement"
require "dependabot/silent/version"

Expand All @@ -18,3 +18,5 @@
require "dependabot/dependency"
Dependabot::Dependency
.register_production_check("silent", ->(groups) { groups.empty? || groups.include?("prod") })

Dependabot::MetadataFinders.register("silent", Dependabot::Silent::MetadataFinder)
32 changes: 32 additions & 0 deletions silent/lib/dependabot/silent/metadata_finder.rb
@@ -0,0 +1,32 @@
# typed: strong
# frozen_string_literal: true

require "dependabot/metadata_finders"
require "dependabot/metadata_finders/base"

module Dependabot
module Silent
class MetadataFinder < Dependabot::MetadataFinders::Base
extend T::Sig

sig { returns(String) }
def homepage_url
""
end

private

sig { override.returns(Dependabot::Source) }
def look_up_source
Dependabot::Source.new(
provider: "example",
hostname: "example.com",
api_endpoint: "https://example.com/api/v3",
repo: dependency.name,
directory: nil,
branch: nil
)
end
end
end
end

0 comments on commit e8f477a

Please sign in to comment.