Skip to content

Commit

Permalink
Simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
credfeto committed Apr 19, 2024
1 parent 348cc94 commit 73b6174
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions src/Credfeto.Package.Update/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private static async Task ParsedOkAsync(Options options)
await packageCache.SaveAsync(fileName: options.Cache, cancellationToken: CancellationToken.None);
}

if (updatesMade.Count == 0)
if (updatesMade is [])
{
throw new NoPackagesUpdatedException();
}
Expand Down Expand Up @@ -142,22 +142,24 @@ private static void OutputPackageUpdateTags(IReadOnlyList<PackageVersion> update

private static IReadOnlyList<PackageMatch> GetExcludedPackages(IReadOnlyList<string> excludes)
{
if (excludes.Count == 0)
if (excludes is [])
{
return [];
}

return
[
.. excludes.Select(exclude =>
{
PackageMatch packageMatch = ExtractSearchPackage(exclude);
.. excludes.Select(GetExclusion)
];

Console.WriteLine($"Excluding {packageMatch.PackageId} (Using Prefix match: {packageMatch.Prefix})");
static PackageMatch GetExclusion(string exclude)
{
PackageMatch packageMatch = ExtractSearchPackage(exclude);

return packageMatch;
})
];
Console.WriteLine($"Excluding {packageMatch.PackageId} (Using Prefix match: {packageMatch.Prefix})");

return packageMatch;
}
}

private static PackageMatch ExtractSearchPackage(string exclude)
Expand Down
2 changes: 1 addition & 1 deletion src/Credfeto.Package/Services/PackageUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async ValueTask<IReadOnlyList<PackageVersion>> UpdateAsync(string basePat
{
matching = await this._packageRegistry.FindPackagesAsync(packageIds: packageIds, packageSources: packageSources, cancellationToken: cancellationToken);

if (matching.Count == 0)
if (matching is [])
{
this._logger.NoMatchingPackagesInEventSource();

Expand Down

0 comments on commit 73b6174

Please sign in to comment.