Skip to content

Commit 9bce72a

Browse files
committed
C#: Address review comments.
1 parent e30e0a9 commit 9bce72a

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private IEnumerable<string> GetFeedsFromNugetConfig(string nugetConfigPath) =>
9090

9191
public string FeedsToRestoreArgument(IEnumerable<string> feeds, string sourceArgumentPrefix)
9292
{
93-
// If there are no feeds, we want to override any default feeds that `dotnet restore` would use by passing a dummy source argument.
93+
// If there are no feeds, we want to override any default feeds that `restore` would use by passing a dummy source argument.
9494
if (!feeds.Any())
9595
{
9696
return $" {sourceArgumentPrefix} \"{emptyPackageDirectory.DirInfo.FullName}\"";
@@ -112,7 +112,7 @@ public string FeedsToRestoreArgument(IEnumerable<string> feeds, string sourceArg
112112
/// (1) Use the feeds we get from `dotnet nuget list source`
113113
/// (2) Use private registries, if they are configured
114114
/// </summary>
115-
/// <param name="path">Path to project/solution</param>
115+
/// <param name="path">Path to project/solution/packages.config</param>
116116
/// <param name="reachableFeeds">The set of reachable NuGet feeds.</param>
117117
/// <returns>The list of NuGet feeds to use for this restore.</returns>
118118
public IEnumerable<string> FeedsToUse(string path, HashSet<string> reachableFeeds)

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ private class NugetExeWrapper : IPackagesConfigRestore
7272
private bool IsDefaultFeedReachable =>
7373
isDefaultFeedReachable ??= feedManager.IsDefaultFeedReachable();
7474

75-
76-
7775
/// <summary>
7876
/// Create the package manager for a specified source tree.
7977
/// </summary>
@@ -175,7 +173,8 @@ private bool TryRestoreNugetPackage(string packagesConfig)
175173
var feedsToUse = feedManager.FeedsToUse(packagesConfig, reachableFeeds).ToList();
176174
var useDefaultFeed = feedsToUse.Count == 0 && IsDefaultFeedReachable;
177175

178-
// Explicitly construct the sources to be used for the restore command if any of the following is true:
176+
// Explicitly construct the sources to be used for the restore command when checking feed
177+
// responsiveness, using private registries, or falling back to nuget.org.
179178
if (feedManager.CheckNugetFeedResponsiveness || feedManager.HasPrivateRegistryFeeds || useDefaultFeed)
180179
{
181180
if (useDefaultFeed)

0 commit comments

Comments
 (0)