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 1727bc7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/sorbet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
with:
bundler-cache: true

- run: bundle exec srb --version

- run: ruby -v

- run: bundle exec tapioca gem --verify

- run: bundle exec srb tc
Expand Down
37 changes: 11 additions & 26 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 @@ -41,10 +38,10 @@ def ecosystem
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(
discovery_json_reader = Dependabot::Nuget::NativeDiscoveryJsonReader.run_discovery_in_directory(
repo_contents_path: T.must(repo_contents_path),
directory: directory,
credentials: credentials
Expand All @@ -53,18 +50,17 @@ 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
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 +108,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 1727bc7

Please sign in to comment.