@@ -755,13 +755,10 @@ private bool IsFeedReachable(string feed, int timeoutMilliSeconds, int tryCount,
755755 }
756756
757757 /// <summary>
758- /// Checks that we can connect to the specified NuGet feeds .
758+ /// Retrieves a list of excluded NuGet feeds from the corresponding environment variable .
759759 /// </summary>
760- /// <param name="feeds">The set of package feeds to check.</param>
761- /// <returns>True if all feeds are reachable or false otherwise.</returns>
762- private bool CheckSpecifiedFeeds ( HashSet < string > feeds )
760+ private HashSet < string > GetExcludedFeeds ( )
763761 {
764- // Exclude any feeds that are configured by the corresponding environment variable.
765762 var excludedFeeds = EnvironmentVariables . GetURLs ( EnvironmentVariableNames . ExcludedNugetFeedsFromResponsivenessCheck )
766763 . ToHashSet ( ) ;
767764
@@ -770,10 +767,35 @@ private bool CheckSpecifiedFeeds(HashSet<string> feeds)
770767 logger . LogInfo ( $ "Excluded NuGet feeds from responsiveness check: { string . Join ( ", " , excludedFeeds . OrderBy ( f => f ) ) } ") ;
771768 }
772769
770+ return excludedFeeds ;
771+ }
772+
773+ /// <summary>
774+ /// Checks that we can connect to the specified NuGet feeds.
775+ /// </summary>
776+ /// <param name="feeds">The set of package feeds to check.</param>
777+ /// <returns>True if all feeds are reachable or false otherwise.</returns>
778+ private bool CheckSpecifiedFeeds ( HashSet < string > feeds )
779+ {
780+ // Exclude any feeds that are configured by the corresponding environment variable.
781+ var excludedFeeds = GetExcludedFeeds ( ) ;
782+
773783 var feedsToCheck = feeds . Where ( feed => ! excludedFeeds . Contains ( feed ) ) . ToHashSet ( ) ;
774784 var reachableFeeds = this . GetReachableNuGetFeeds ( feedsToCheck , isFallback : false ) ;
775785 var allFeedsReachable = reachableFeeds . Count == feedsToCheck . Count ;
776786
787+ this . EmitUnreachableFeedsDiagnostics ( allFeedsReachable ) ;
788+
789+ return allFeedsReachable ;
790+ }
791+
792+ /// <summary>
793+ /// If <paramref name="allFeedsReachable"/> is `false`, logs this and emits a diagnostic.
794+ /// Adds a `CompilationInfos` entry either way.
795+ /// </summary>
796+ /// <param name="allFeedsReachable">Whether all feeds were reachable or not.</param>
797+ private void EmitUnreachableFeedsDiagnostics ( bool allFeedsReachable )
798+ {
777799 if ( ! allFeedsReachable )
778800 {
779801 logger . LogWarning ( "Found unreachable NuGet feed in C# analysis with build-mode 'none'. This may cause missing dependencies in the analysis." ) ;
@@ -787,8 +809,6 @@ private bool CheckSpecifiedFeeds(HashSet<string> feeds)
787809 ) ) ;
788810 }
789811 compilationInfoContainer . CompilationInfos . Add ( ( "All NuGet feeds reachable" , allFeedsReachable ? "1" : "0" ) ) ;
790-
791- return allFeedsReachable ;
792812 }
793813
794814 private IEnumerable < string > GetFeeds ( Func < IList < string > > getNugetFeeds )
0 commit comments