Skip to content

Commit 0e350d0

Browse files
committed
C#: Minor re-write to enable OS independant testing of dependabot proxy object creation.
1 parent 52793b0 commit 0e350d0

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ private DependabotProxy(IDependabotProxyConfiguration config, ILogger logger, Te
7676
}
7777
}
7878

79-
80-
internal static IDependabotProxy? GetDependabotProxy(
81-
ILogger logger, IDiagnosticsWriter diagnosticsWriter, TemporaryDirectory tempWorkingDirectory)
79+
internal static IDependabotProxy? Make(ILogger logger, IDiagnosticsWriter diagnosticsWriter, TemporaryDirectory tempWorkingDirectory)
8280
{
8381
// Setting HTTP(S)_PROXY and SSL_CERT_FILE have no effect on Windows or macOS,
8482
// but we would still end up using the Dependabot proxy to check for feed reachability.
@@ -90,8 +88,12 @@ private DependabotProxy(IDependabotProxyConfiguration config, ILogger logger, Te
9088
return null;
9189
}
9290

93-
var proxyConfig = new DependabotProxyConfiguration();
91+
return MakeAux(new DependabotProxyConfiguration(), logger, diagnosticsWriter, tempWorkingDirectory);
92+
}
9493

94+
internal static IDependabotProxy? MakeAux(
95+
IDependabotProxyConfiguration proxyConfig, ILogger logger, IDiagnosticsWriter diagnosticsWriter, TemporaryDirectory tempWorkingDirectory)
96+
{
9597
if (string.IsNullOrWhiteSpace(proxyConfig.Host) || string.IsNullOrWhiteSpace(proxyConfig.Port))
9698
{
9799
logger.LogInfo("No Dependabot proxy credentials are configured.");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void exitCallback(int ret, string msg, bool silent)
106106
return BuildScript.Success;
107107
}).Run(SystemBuildActions.Instance, startCallback, exitCallback);
108108

109-
dependabotProxy = DependabotProxy.GetDependabotProxy(logger, diagnosticsWriter, tempWorkingDirectory);
109+
dependabotProxy = DependabotProxy.Make(logger, diagnosticsWriter, tempWorkingDirectory);
110110

111111
try
112112
{

0 commit comments

Comments
 (0)