Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove named tuples where not needed #356

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions PackageIndexer/DotnetPackageIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private static async Task<IReadOnlyList<PackageIdentity>> GetPackagesAsync(
params string[] feedUrls
)
{
var packages = new List<(PackageIdentity packageId, bool isDeprecated)>();
var packages = new List<(PackageIdentity, bool)>();

foreach (string feedUrl in feedUrls)
{
Expand All @@ -59,7 +59,7 @@ params string[] feedUrls
return latestVersions;
}

private static async Task<IReadOnlyList<(PackageIdentity packageId, bool isDeprecated)>> GetPackagesAsync(NuGetFeed feed)
private static async Task<IReadOnlyList<(PackageIdentity, bool)>> GetPackagesAsync(NuGetFeed feed)
{
Console.WriteLine($"Getting packages from {feed.FeedUrl}...");

Expand All @@ -70,7 +70,7 @@ params string[] feedUrls
throw new ApplicationException("NuGetOrg should be the only feed.");
}

private static async Task<IReadOnlyList<(PackageIdentity version, bool isDeprecated)>> GetPackagesFromNuGetOrgAsync(NuGetFeed feed)
private static async Task<IReadOnlyList<(PackageIdentity, bool)>> GetPackagesFromNuGetOrgAsync(NuGetFeed feed)
{
Console.WriteLine("Fetching owner information...");
Dictionary<string, string[]> ownerInformation = await feed.GetOwnerMappingAsync();
Expand All @@ -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)
{
Expand All @@ -114,7 +114,8 @@ bool usePreviewVersions
{
var result = new List<PackageIdentity>();

IEnumerable<IGrouping<string, (PackageIdentity packageId, bool isDeprecated)>> groups = identities.GroupBy(i => i.Item1.Id).OrderBy(g => g.Key);
IEnumerable<IGrouping<string, (PackageIdentity, bool)>> groups =
identities.GroupBy(i => i.packageId.Id).OrderBy(g => g.Key);

foreach (IGrouping<string, (PackageIdentity packageId, bool isDeprecated)> group in groups)
{
Expand Down
2 changes: 1 addition & 1 deletion PackageIndexer/NuGet/NuGetFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ string feed
logger,
cancellationToken);

List<(NuGetVersion, bool)> versions = new();
List<(NuGetVersion, bool)> versions = [];

foreach (IPackageSearchMetadata package in packages)
{
Expand Down