From 9c390f5529ce60b13bd8a25395990e9184221f1c Mon Sep 17 00:00:00 2001 From: Martin Ruiz Date: Mon, 17 Jul 2023 14:22:33 -0700 Subject: [PATCH] foreach for readability --- .../SolutionRestoreJob.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/NuGet.Clients/NuGet.SolutionRestoreManager/SolutionRestoreJob.cs b/src/NuGet.Clients/NuGet.SolutionRestoreManager/SolutionRestoreJob.cs index 7b441e80793..fc3d619cae5 100644 --- a/src/NuGet.Clients/NuGet.SolutionRestoreManager/SolutionRestoreJob.cs +++ b/src/NuGet.Clients/NuGet.SolutionRestoreManager/SolutionRestoreJob.cs @@ -507,13 +507,19 @@ await _logger.RunWithProgressAsync( { if (isRestoreSucceeded) { - var errors = restoreSummaries.Any(summary => summary.Errors.Any(e => e.Code.Equals(NuGetLogCode.NU1901) || e.Code.Equals(NuGetLogCode.NU1902) || e.Code.Equals(NuGetLogCode.NU1903) || e.Code.Equals(NuGetLogCode.NU1904))); - - if (errors) + foreach (RestoreSummary summary in restoreSummaries) { - await _infoBarService.Value.ShowInfoBar(t); + foreach (IRestoreLogMessage error in summary.Errors) + { + if (error.Code.Equals(NuGetLogCode.NU1901) || error.Code.Equals(NuGetLogCode.NU1902) || error.Code.Equals(NuGetLogCode.NU1903) || error.Code.Equals(NuGetLogCode.NU1904)) + { + await _infoBarService.Value.ShowInfoBar(t); + break; + } + } } - if (!errors && _infoBarService.IsValueCreated) + + if (_infoBarService.IsValueCreated) // if the InfoBar was created and no vulnerabilities found, hide it. { await _infoBarService.Value.HideInfoBar(t); }