Skip to content

Commit ddcd9d5

Browse files
committed
Use GetReachableNuGetFeeds in CheckSpecifiedFeeds
1 parent 1ceb420 commit ddcd9d5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,7 @@ private bool CheckFeeds(out HashSet<string> explicitFeeds, out HashSet<string> a
767767
/// <returns>True if all feeds are reachable or false otherwise.</returns>
768768
private bool CheckSpecifiedFeeds(HashSet<string> feeds)
769769
{
770-
logger.LogInfo("Checking that NuGet feeds are reachable...");
771-
770+
// Exclude any feeds that are configured by the corresponding environment variable.
772771
var excludedFeeds = EnvironmentVariables.GetURLs(EnvironmentVariableNames.ExcludedNugetFeedsFromResponsivenessCheck)
773772
.ToHashSet();
774773

@@ -777,9 +776,10 @@ private bool CheckSpecifiedFeeds(HashSet<string> feeds)
777776
logger.LogInfo($"Excluded NuGet feeds from responsiveness check: {string.Join(", ", excludedFeeds.OrderBy(f => f))}");
778777
}
779778

780-
var (initialTimeout, tryCount) = GetFeedRequestSettings(isFallback: false);
779+
var feedsToCheck = feeds.Where(feed => !excludedFeeds.Contains(feed)).ToHashSet();
780+
var reachableFeeds = this.GetReachableNuGetFeeds(feedsToCheck, isFallback: false);
781+
var allFeedsReachable = reachableFeeds.Count == feedsToCheck.Count;
781782

782-
var allFeedsReachable = feeds.All(feed => excludedFeeds.Contains(feed) || IsFeedReachable(feed, initialTimeout, tryCount));
783783
if (!allFeedsReachable)
784784
{
785785
logger.LogWarning("Found unreachable NuGet feed in C# analysis with build-mode 'none'. This may cause missing dependencies in the analysis.");

0 commit comments

Comments
 (0)