From 88b652a330572e05b1017c9bea575ebe159291ff Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 29 May 2024 09:18:47 -0700 Subject: [PATCH] Remove named tuples where not needed (#356) --- PackageIndexer/DotnetPackageIndex.cs | 13 +++++++------ PackageIndexer/NuGet/NuGetFeed.cs | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/PackageIndexer/DotnetPackageIndex.cs b/PackageIndexer/DotnetPackageIndex.cs index 74e95c2..154636e 100644 --- a/PackageIndexer/DotnetPackageIndex.cs +++ b/PackageIndexer/DotnetPackageIndex.cs @@ -41,7 +41,7 @@ private static async Task> GetPackagesAsync( params string[] feedUrls ) { - var packages = new List<(PackageIdentity packageId, bool isDeprecated)>(); + var packages = new List<(PackageIdentity, bool)>(); foreach (string feedUrl in feedUrls) { @@ -59,7 +59,7 @@ params string[] feedUrls return latestVersions; } - private static async Task> GetPackagesAsync(NuGetFeed feed) + private static async Task> GetPackagesAsync(NuGetFeed feed) { Console.WriteLine($"Getting packages from {feed.FeedUrl}..."); @@ -70,7 +70,7 @@ params string[] feedUrls throw new ApplicationException("NuGetOrg should be the only feed."); } - private static async Task> GetPackagesFromNuGetOrgAsync(NuGetFeed feed) + private static async Task> GetPackagesFromNuGetOrgAsync(NuGetFeed feed) { Console.WriteLine("Fetching owner information..."); Dictionary ownerInformation = await feed.GetOwnerMappingAsync(); @@ -89,11 +89,11 @@ params string[] feedUrls Console.WriteLine("Getting versions..."); - ConcurrentBag<(PackageIdentity packageId, bool isDeprecated)> identities = []; + ConcurrentBag<(PackageIdentity, bool)> identities = []; await Parallel.ForEachAsync(packageIds, async (packageId, _) => { - IReadOnlyList<(NuGetVersion version, bool isDeprecated)> versions = await feed.GetAllVersionsAsync(packageId); + IReadOnlyList<(NuGetVersion, bool)> versions = await feed.GetAllVersionsAsync(packageId); foreach ((NuGetVersion version, bool isDeprecated) version in versions) { @@ -114,7 +114,8 @@ bool usePreviewVersions { var result = new List(); - IEnumerable> groups = identities.GroupBy(i => i.Item1.Id).OrderBy(g => g.Key); + IEnumerable> groups = + identities.GroupBy(i => i.packageId.Id).OrderBy(g => g.Key); foreach (IGrouping group in groups) { diff --git a/PackageIndexer/NuGet/NuGetFeed.cs b/PackageIndexer/NuGet/NuGetFeed.cs index 05c2a62..24550e1 100644 --- a/PackageIndexer/NuGet/NuGetFeed.cs +++ b/PackageIndexer/NuGet/NuGetFeed.cs @@ -153,7 +153,7 @@ string feed logger, cancellationToken); - List<(NuGetVersion, bool)> versions = new(); + List<(NuGetVersion, bool)> versions = []; foreach (IPackageSearchMetadata package in packages) {