Skip to content

Commit

Permalink
Strict type Dependabot::Pub::FileFetcher (#10133)
Browse files Browse the repository at this point in the history
* Strict type Dependabot::Pub::FileFetcher.

* Strict type Dependabot::Pub::FileFetcher.
  • Loading branch information
raj-meka authored Jul 3, 2024
1 parent e44facc commit 8afacf0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pub/lib/dependabot/pub/file_fetcher.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true
# typed: strong
# frozen_string_literal: true

require "sorbet-runtime"
Expand All @@ -13,10 +13,12 @@ class FileFetcher < Dependabot::FileFetchers::Base
extend T::Sig
extend T::Helpers

sig { override.params(filenames: T::Array[String]).returns(T::Boolean) }
def self.required_files_in?(filenames)
filenames.include?("pubspec.yaml")
end

sig { override.returns(String) }
def self.required_files_message
"Repo must contain a pubspec.yaml."
end
Expand All @@ -38,14 +40,16 @@ def fetch_files

private

sig { returns(DependencyFile) }
def pubspec_yaml
@pubspec_yaml ||= fetch_file_from_host("pubspec.yaml")
@pubspec_yaml ||= T.let(fetch_file_from_host("pubspec.yaml"), T.nilable(Dependabot::DependencyFile))
end

sig { returns(T.nilable(DependencyFile)) }
def pubspec_lock
return @pubspec_lock if defined?(@pubspec_lock)

@pubspec_lock = fetch_file_if_present("pubspec.lock")
@pubspec_lock = T.let(fetch_file_if_present("pubspec.lock"), T.nilable(Dependabot::DependencyFile))
end
end
end
Expand Down

0 comments on commit 8afacf0

Please sign in to comment.