@@ -700,11 +700,36 @@ private bool IsFeedReachable(string feed, int timeoutMilliSeconds, int tryCount,
700700 return ( timeoutMilliSeconds , tryCount ) ;
701701 }
702702
703+ /// <summary>
704+ /// Checks that we can connect to all Nuget feeds that are explicitly configured in configuration files.
705+ /// </summary>
706+ /// <param name="explicitFeeds">Outputs the set of explicit feeds.</param>
707+ /// <returns>True if all feeds are reachable or false otherwise.</returns>
703708 private bool CheckFeeds ( out HashSet < string > explicitFeeds )
704709 {
705- logger . LogInfo ( "Checking Nuget feeds..." ) ;
706710 ( explicitFeeds , var allFeeds ) = GetAllFeeds ( ) ;
707711
712+ var allFeedsReachable = this . CheckFeeds ( explicitFeeds ) ;
713+
714+ var inheritedFeeds = allFeeds . Except ( explicitFeeds ) . ToHashSet ( ) ;
715+ if ( inheritedFeeds . Count > 0 )
716+ {
717+ logger . LogInfo ( $ "Inherited Nuget feeds (not checked for reachability): { string . Join ( ", " , inheritedFeeds . OrderBy ( f => f ) ) } ") ;
718+ compilationInfoContainer . CompilationInfos . Add ( ( "Inherited Nuget feed count" , inheritedFeeds . Count . ToString ( ) ) ) ;
719+ }
720+
721+ return allFeedsReachable ;
722+ }
723+
724+ /// <summary>
725+ /// Checks that we can connect to the specified Nuget feeds.
726+ /// </summary>
727+ /// <param name="feeds">The set of package feeds to check.</param>
728+ /// <returns>True if all feeds are reachable or false otherwise.</returns>
729+ private bool CheckFeeds ( HashSet < string > feeds )
730+ {
731+ logger . LogInfo ( "Checking that Nuget feeds are reachable..." ) ;
732+
708733 var excludedFeeds = EnvironmentVariables . GetURLs ( EnvironmentVariableNames . ExcludedNugetFeedsFromResponsivenessCheck )
709734 . ToHashSet ( ) ;
710735
@@ -715,7 +740,7 @@ private bool CheckFeeds(out HashSet<string> explicitFeeds)
715740
716741 var ( initialTimeout , tryCount ) = GetFeedRequestSettings ( isFallback : false ) ;
717742
718- var allFeedsReachable = explicitFeeds . All ( feed => excludedFeeds . Contains ( feed ) || IsFeedReachable ( feed , initialTimeout , tryCount ) ) ;
743+ var allFeedsReachable = feeds . All ( feed => excludedFeeds . Contains ( feed ) || IsFeedReachable ( feed , initialTimeout , tryCount ) ) ;
719744 if ( ! allFeedsReachable )
720745 {
721746 logger . LogWarning ( "Found unreachable Nuget feed in C# analysis with build-mode 'none'. This may cause missing dependencies in the analysis." ) ;
@@ -730,14 +755,6 @@ private bool CheckFeeds(out HashSet<string> explicitFeeds)
730755 }
731756 compilationInfoContainer . CompilationInfos . Add ( ( "All Nuget feeds reachable" , allFeedsReachable ? "1" : "0" ) ) ;
732757
733-
734- var inheritedFeeds = allFeeds . Except ( explicitFeeds ) . ToHashSet ( ) ;
735- if ( inheritedFeeds . Count > 0 )
736- {
737- logger . LogInfo ( $ "Inherited Nuget feeds (not checked for reachability): { string . Join ( ", " , inheritedFeeds . OrderBy ( f => f ) ) } ") ;
738- compilationInfoContainer . CompilationInfos . Add ( ( "Inherited Nuget feed count" , inheritedFeeds . Count . ToString ( ) ) ) ;
739- }
740-
741758 return allFeedsReachable ;
742759 }
743760
0 commit comments