From 13be732da92e3fab57c5a036cf8894fc803ff4ad Mon Sep 17 00:00:00 2001 From: Tyrel Souza <923113+tyrelsouza@users.noreply.github.com> Date: Thu, 21 Jan 2021 16:56:41 -0500 Subject: [PATCH 1/4] Pick a different framework in nuget, untested yet --- lib/bibliothecary/parsers/nuget.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/bibliothecary/parsers/nuget.rb b/lib/bibliothecary/parsers/nuget.rb index 3a8664db..77cb4adb 100644 --- a/lib/bibliothecary/parsers/nuget.rb +++ b/lib/bibliothecary/parsers/nuget.rb @@ -70,10 +70,12 @@ def self.parse_packages_lock_json(file_contents) if frameworks.size > 0 # we should really return multiple manifests, but bibliothecary doesn't # do that yet so at least pick deterministically. - frameworks[frameworks.keys.sort.last] - else - [] + + # Note, frameworks can be empty, so remove empty ones and then return the last sorted item if any + frameworks = frameworks.delete_if { |k, v| v.empty? } + return frameworks[frameworks.keys.sort.last] unless frameworks.empty? end + [] end def self.parse_packages_config(file_contents) From acdb0b9d3a30d2c4cb3a483ad2baebf113fadf3b Mon Sep 17 00:00:00 2001 From: Tyrel Souza <923113+tyrelsouza@users.noreply.github.com> Date: Fri, 22 Jan 2021 09:21:45 -0500 Subject: [PATCH 2/4] test was a bit easier --- spec/fixtures/packages.lock.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/fixtures/packages.lock.json b/spec/fixtures/packages.lock.json index fb765a6e..3c3939cb 100644 --- a/spec/fixtures/packages.lock.json +++ b/spec/fixtures/packages.lock.json @@ -1,6 +1,7 @@ { "version": 1, "dependencies": { + ".empty-list-earlier-alphabetically": {}, ".NETCoreApp,Version=v2.2": { "Microsoft.AspNetCore.App": { "type": "Direct", @@ -3099,6 +3100,7 @@ "System.Xml.XPath": "4.3.0" } } - } + }, + "empty-list-later-alphabetically": {} } } \ No newline at end of file From a4e2476fc17e24eab8a2a3ba1381a03bb32c6696 Mon Sep 17 00:00:00 2001 From: Tyrel Souza <923113+tyrelsouza@users.noreply.github.com> Date: Fri, 22 Jan 2021 09:23:07 -0500 Subject: [PATCH 3/4] sort better --- spec/fixtures/packages.lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/fixtures/packages.lock.json b/spec/fixtures/packages.lock.json index 3c3939cb..a0633ec6 100644 --- a/spec/fixtures/packages.lock.json +++ b/spec/fixtures/packages.lock.json @@ -1,7 +1,7 @@ { "version": 1, "dependencies": { - ".empty-list-earlier-alphabetically": {}, + ".Empty-list-earlier-alphabetically": {}, ".NETCoreApp,Version=v2.2": { "Microsoft.AspNetCore.App": { "type": "Direct", @@ -3101,6 +3101,6 @@ } } }, - "empty-list-later-alphabetically": {} + "Empty-list-later-alphabetically": {} } } \ No newline at end of file From b881e4bea6a7b263639edb04ff1b8c587abd06c5 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Fri, 22 Jan 2021 09:28:09 -0500 Subject: [PATCH 4/4] Apply suggestions from code review fixing some wording. --- spec/fixtures/packages.lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/fixtures/packages.lock.json b/spec/fixtures/packages.lock.json index a0633ec6..cf596059 100644 --- a/spec/fixtures/packages.lock.json +++ b/spec/fixtures/packages.lock.json @@ -1,7 +1,7 @@ { "version": 1, "dependencies": { - ".Empty-list-earlier-alphabetically": {}, + ".Empty-group-earlier-alphabetically": {}, ".NETCoreApp,Version=v2.2": { "Microsoft.AspNetCore.App": { "type": "Direct", @@ -3101,6 +3101,6 @@ } } }, - "Empty-list-later-alphabetically": {} + "Empty-group-later-alphabetically": {} } -} \ No newline at end of file +}