Skip to content

Commit 7051db5

Browse files
committed
Fix code review findings
1 parent 9aa85f2 commit 7051db5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.Nuget.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ private static async Task ExecuteGetRequest(string address, HttpClient httpClien
387387

388388
private bool IsFeedReachable(string feed)
389389
{
390+
logger.LogInfo($"Checking if Nuget feed '{feed}' is reachable...");
390391
using HttpClient client = new();
391392
var timeoutSeconds = 1;
392393
var tryCount = 4;
@@ -432,7 +433,7 @@ private bool CheckFeeds(List<FileInfo> allFiles)
432433

433434
if (excludedFeeds.Count > 0)
434435
{
435-
logger.LogInfo($"Excluded feeds from responsiveness check: {string.Join(", ", excludedFeeds)}");
436+
logger.LogInfo($"Excluded feeds from responsiveness check: {string.Join(", ", excludedFeeds.OrderBy(f => f))}");
436437
}
437438

438439
var allFeedsReachable = feeds.All(feed => excludedFeeds.Contains(feed) || IsFeedReachable(feed));
@@ -481,9 +482,10 @@ private HashSet<string> GetAllFeeds(List<FileInfo> allFiles)
481482
{
482483
var nugetConfigs = GetAllNugetConfigs(allFiles);
483484
var feeds = nugetConfigs
484-
.SelectMany(nf => GetFeeds(nf))
485+
.SelectMany(GetFeeds)
485486
.Where(str => !string.IsNullOrWhiteSpace(str))
486487
.ToHashSet();
488+
logger.LogInfo($"Found Nuget feeds in nuget.config files: {string.Join(", ", feeds.OrderBy(f => f))}");
487489
return feeds;
488490
}
489491

@@ -493,7 +495,7 @@ private HashSet<string> GetAllFeeds(List<FileInfo> allFiles)
493495
[GeneratedRegex(@"^(.+)\.(\d+\.\d+\.\d+(-(.+))?)$", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline)]
494496
private static partial Regex LegacyNugetPackage();
495497

496-
[GeneratedRegex(@"^E (.*)$", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline)]
498+
[GeneratedRegex(@"^E\s(.*)$", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline)]
497499
private static partial Regex EnabledNugetFeed();
498500
}
499501
}

0 commit comments

Comments
 (0)