Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sachin-sandhu committed Dec 11, 2024
1 parent 817438f commit 529ddd2
Showing 1 changed file with 15 additions and 28 deletions.
43 changes: 15 additions & 28 deletions nuget/lib/dependabot/nuget/file_parser.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# typed: strong
# frozen_string_literal: true
# typed: strict

require "dependabot/dependency"
require "dependabot/file_parsers"
require "dependabot/file_parsers/base"
require "dependabot/nuget/native_discovery/native_discovery_json_reader"
require "dependabot/nuget/native_helpers"
require "dependabot/nuget/package_manager"
require "dependabot/nuget/native_discovery/native_dependency_file_discovery"
require "dependabot/nuget/native_discovery/native_project_discovery"
require "dependabot/nuget/language"
require "sorbet-runtime"

Expand Down Expand Up @@ -38,13 +35,13 @@ def ecosystem
)
end

private

sig { returns(T::Array[Dependabot::Dependency]) }
def dependencies
@dependencies ||= T.let(begin
def content_json
@content_json ||= T.let(begin
directory = source&.directory || "/"
discovery_json_reader = NativeDiscoveryJsonReader.run_discovery_in_directory(
obj = ::Dependabot::Nuget::NativeDiscoveryJsonReader

discovery_json_reader = obj.run_discovery_in_directory(
repo_contents_path: T.must(repo_contents_path),
directory: directory,
credentials: credentials
Expand All @@ -53,18 +50,19 @@ def dependencies
end, T.nilable(T::Array[Dependabot::Dependency]))
end

sig { returns(T.nilable(T::Array[Dependabot::Nuget::NativeProjectDiscovery])) }
def content
@content ||= T.let(begin
private

sig { returns(T::Array[Dependabot::Dependency]) }
def dependencies
@dependencies ||= T.let(begin
directory = source&.directory || "/"
discovery_json_reader = NativeDiscoveryJsonReader.run_discovery_in_directory(
repo_contents_path: T.must(repo_contents_path),
directory: directory,
credentials: credentials
)

discovery_json_reader.workspace_discovery&.projects
end, T.nilable(T::Array[Dependabot::Nuget::NativeProjectDiscovery]))
discovery_json_reader.dependency_set.dependencies
end, T.nilable(T::Array[Dependabot::Dependency]))
end

sig { override.void }
Expand Down Expand Up @@ -112,19 +110,8 @@ def language

sig { returns(T.nilable(T::Array[T.nilable(String)])) }
def framework_version
# x debugger

# T.nilable(Dependabot::Nuget::NativeWorkspaceDiscovery))
# workplace_json = T.let(content.send(:workspace_discovery),
# T.nilable(Dependabot::Nuget::NativeWorkspaceDiscovery))
# project_json = T.let(workplace_json.send(:projects),
# T::Array[NativeProjectDiscovery])
content&.map do |framework|
# T.let(T.let(framework.instance_variable_get(:@target_frameworks), T::Array[String]).first,
# T.nilable(String))
# debugger
T.let(framework.instance_variable_get(:@target_frameworks), T::Array[String]).first
end
# pending due to some issue with sorbet during CI tests
[]
rescue StandardError
nil
end
Expand Down

0 comments on commit 529ddd2

Please sign in to comment.