From 5e7d906d8870dbf783c1742722a67cdf0b484fc5 Mon Sep 17 00:00:00 2001 From: Logan Bussell Date: Tue, 17 Dec 2024 11:50:16 -0800 Subject: [PATCH] Use private field for script path --- .../ScriptRunnerUpdater.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/eng/update-dependencies/ScriptRunnerUpdater.cs b/eng/update-dependencies/ScriptRunnerUpdater.cs index b9e69b5e86..2d761bce3c 100644 --- a/eng/update-dependencies/ScriptRunnerUpdater.cs +++ b/eng/update-dependencies/ScriptRunnerUpdater.cs @@ -15,26 +15,23 @@ namespace Dotnet.Docker /// public class ScriptRunnerUpdater : IDependencyUpdater { - public required string ScriptPath { get; init; } + private readonly string _scriptPath; - private ScriptRunnerUpdater() + private ScriptRunnerUpdater(string scriptPath) { + _scriptPath = scriptPath; } public static IDependencyUpdater GetDockerfileUpdater(string repoRoot) { - return new ScriptRunnerUpdater() - { - ScriptPath = Path.Combine(repoRoot, "eng", "dockerfile-templates", "Get-GeneratedDockerfiles.ps1") - }; + string scriptPath = Path.Combine(repoRoot, "eng", "dockerfile-templates", "Get-GeneratedDockerfiles.ps1"); + return new ScriptRunnerUpdater(scriptPath); } public static IDependencyUpdater GetReadMeUpdater(string repoRoot) { - return new ScriptRunnerUpdater() - { - ScriptPath = Path.Combine(repoRoot, "eng", "readme-templates", "Get-GeneratedReadmes.ps1") - }; + string scriptPath = Path.Combine(repoRoot, "eng", "readme-templates", "Get-GeneratedReadmes.ps1"); + return new ScriptRunnerUpdater(scriptPath); } public IEnumerable GetUpdateTasks(IEnumerable dependencyInfos) => @@ -47,24 +44,24 @@ public IEnumerable GetUpdateTasks(IEnumerable