From 439e37a1984febc49d63e9eb8d900e48d126f8db Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 27 Feb 2026 14:23:03 +0000 Subject: [PATCH] Use `GetReachableNuGetFeeds` in `CheckSpecifiedFeeds` --- .../NugetPackageRestorer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs index 33e8db19eab..5d7ad8f6124 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs @@ -767,8 +767,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching /// True if all feeds are reachable or false otherwise. private bool CheckSpecifiedFeeds(HashSet feeds) { - logger.LogInfo("Checking that NuGet feeds are reachable..."); - + // Exclude any feeds that are configured by the corresponding environment variable. var excludedFeeds = EnvironmentVariables.GetURLs(EnvironmentVariableNames.ExcludedNugetFeedsFromResponsivenessCheck) .ToHashSet(); @@ -777,9 +776,10 @@ namespace Semmle.Extraction.CSharp.DependencyFetching logger.LogInfo($"Excluded NuGet feeds from responsiveness check: {string.Join(", ", excludedFeeds.OrderBy(f => f))}"); } - var (initialTimeout, tryCount) = GetFeedRequestSettings(isFallback: false); + var feedsToCheck = feeds.Where(feed => !excludedFeeds.Contains(feed)).ToHashSet(); + var reachableFeeds = this.GetReachableNuGetFeeds(feedsToCheck, isFallback: false); + var allFeedsReachable = reachableFeeds.Count == feedsToCheck.Count; - var allFeedsReachable = feeds.All(feed => excludedFeeds.Contains(feed) || IsFeedReachable(feed, initialTimeout, tryCount)); if (!allFeedsReachable) { logger.LogWarning("Found unreachable NuGet feed in C# analysis with build-mode 'none'. This may cause missing dependencies in the analysis.");