Skip to content

Commit 70996a4

Browse files
committed
C#: Rename dllDirNames to dllPaths.
1 parent 576eda3 commit 70996a4

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public DependencyManager(string srcDir, IDependencyOptions options, ILogger logg
8181
var solutions = options.SolutionFile is not null
8282
? new[] { options.SolutionFile }
8383
: allNonBinaryFiles.SelectFileNamesByExtension(".sln");
84-
var dllDirNames = options.DllDirs.Count == 0
84+
var dllPaths = options.DllDirs.Count == 0
8585
? allFiles.SelectFileNamesByExtension(".dll").ToList()
8686
: options.DllDirs.Select(Path.GetFullPath).ToList();
8787

@@ -107,20 +107,19 @@ public DependencyManager(string srcDir, IDependencyOptions options, ILogger logg
107107
.Select(d => Path.Combine(packageDirectory.DirInfo.FullName, d))
108108
.ToList();
109109

110-
// TODO: Rename the dllDirNames var - it's not only dirs anymore.
111-
dllDirNames.AddRange(paths);
112-
DownloadMissingPackages(allNonBinaryFiles, dllDirNames);
110+
dllPaths.AddRange(paths);
111+
DownloadMissingPackages(allNonBinaryFiles, dllPaths);
113112
}
114113

115114
// Find DLLs in the .Net / Asp.Net Framework
116115
// This block needs to come after the nuget restore, because the nuget restore might fetch the .NET Core/Framework reference assemblies.
117116
if (options.ScanNetFrameworkDlls)
118117
{
119-
AddNetFrameworkDlls(dllDirNames);
120-
AddAspNetFrameworkDlls(dllDirNames);
118+
AddNetFrameworkDlls(dllPaths);
119+
AddAspNetFrameworkDlls(dllPaths);
121120
}
122121

123-
assemblyCache = new AssemblyCache(dllDirNames, progressMonitor);
122+
assemblyCache = new AssemblyCache(dllPaths, progressMonitor);
124123
AnalyseSolutions(solutions);
125124

126125
foreach (var filename in assemblyCache.AllAssemblies.Select(a => a.Filename))
@@ -220,7 +219,7 @@ private void RemoveNugetAnalyzerReferences()
220219
}
221220
}
222221

223-
private void AddNetFrameworkDlls(List<string> dllDirNames)
222+
private void AddNetFrameworkDlls(List<string> dllPaths)
224223
{
225224
// Multiple dotnet framework packages could be present.
226225
// The order of the packages is important, we're adding the first one that is present in the nuget cache.
@@ -238,7 +237,7 @@ private void AddNetFrameworkDlls(List<string> dllDirNames)
238237

239238
if (frameworkPath is not null)
240239
{
241-
dllDirNames.Add(frameworkPath);
240+
dllPaths.Add(frameworkPath);
242241
progressMonitor.LogInfo("Found .NET Core/Framework DLLs in NuGet packages. Not adding installation directory.");
243242
return;
244243
}
@@ -261,10 +260,10 @@ private void AddNetFrameworkDlls(List<string> dllDirNames)
261260
runtimeLocation ??= Runtime.ExecutingRuntime;
262261

263262
progressMonitor.LogInfo($".NET runtime location selected: {runtimeLocation}");
264-
dllDirNames.Add(runtimeLocation);
263+
dllPaths.Add(runtimeLocation);
265264
}
266265

267-
private void AddAspNetFrameworkDlls(List<string> dllDirNames)
266+
private void AddAspNetFrameworkDlls(List<string> dllPaths)
268267
{
269268
if (!fileContent.IsNewProjectStructureUsed || !fileContent.UseAspNetCoreDlls)
270269
{
@@ -275,12 +274,12 @@ private void AddAspNetFrameworkDlls(List<string> dllDirNames)
275274
if (GetPackageDirectory("microsoft.aspnetcore.app.ref") is string aspNetCorePackage)
276275
{
277276
progressMonitor.LogInfo($"Found ASP.NET Core in NuGet packages. Not adding installation directory.");
278-
dllDirNames.Add(aspNetCorePackage);
277+
dllPaths.Add(aspNetCorePackage);
279278
}
280279
else if (Runtime.AspNetCoreRuntime is string aspNetCoreRuntime)
281280
{
282281
progressMonitor.LogInfo($"ASP.NET runtime location selected: {aspNetCoreRuntime}");
283-
dllDirNames.Add(aspNetCoreRuntime);
282+
dllPaths.Add(aspNetCoreRuntime);
284283
}
285284
}
286285

@@ -663,7 +662,7 @@ private void RestoreProjects(IEnumerable<string> projects, out IEnumerable<strin
663662
assets = assetFiles;
664663
}
665664

666-
private void DownloadMissingPackages(List<FileInfo> allFiles, List<string> dllDirNames)
665+
private void DownloadMissingPackages(List<FileInfo> allFiles, List<string> dllPaths)
667666
{
668667
var nugetConfigs = allFiles.SelectFileNamesByName("nuget.config").ToArray();
669668
string? nugetConfig = null;
@@ -712,7 +711,7 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, List<string> dllDi
712711
}
713712
});
714713

715-
dllDirNames.Add(missingPackageDirectory.DirInfo.FullName);
714+
dllPaths.Add(missingPackageDirectory.DirInfo.FullName);
716715
}
717716

718717
private void AnalyseSolutions(IEnumerable<string> solutions)

0 commit comments

Comments
 (0)