From 4b76c678843c06abe1be58b7e48c81a3ddeb32b0 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Wed, 23 Oct 2024 21:50:26 +0000 Subject: [PATCH 1/4] updated to dotnet 8 and c# 12 --- .devcontainer/Dockerfile | 3 --- .devcontainer/devcontainer.json | 9 +-------- .github/dependabot.yml | 7 ++++++- src/Octoshift/Octoshift.csproj | 3 ++- .../OctoshiftCLI.IntegrationTests.csproj | 3 ++- src/OctoshiftCLI.Tests/OctoshiftCLI.Tests.csproj | 6 ++---- src/ado2gh/ado2gh.csproj | 4 ++-- src/bbs2gh/bbs2gh.csproj | 4 ++-- src/gei/gei.csproj | 4 +++- 9 files changed, 20 insertions(+), 23 deletions(-) delete mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 3ad916caa..000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -# [Choice] .NET version: 6.0, 3.1, 6.0-bullseye, 3.1-bullseye, 6.0-focal, 3.1-focal -ARG VARIANT=6.0-bullseye -FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index eaa44921c..66973154e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,13 +1,6 @@ { "name": "C# (.NET)", - "build": { - "dockerfile": "Dockerfile", - "args": { - // Update 'VARIANT' to pick a .NET Core version: 3.1, 6.0 - // Append -bullseye or -focal to pin to an OS version. - "VARIANT": "6.0-bullseye" - } - }, + "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", // Configure tool-specific properties. "customizations": { diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e790b00f0..ee4a6e7a5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,8 @@ # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: +# Please see the documentation for more information: # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot version: 2 updates: @@ -13,3 +14,7 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/src/Octoshift/Octoshift.csproj b/src/Octoshift/Octoshift.csproj index ab4992314..c63637b72 100644 --- a/src/Octoshift/Octoshift.csproj +++ b/src/Octoshift/Octoshift.csproj @@ -1,8 +1,9 @@ - net6.0 + net8.0 OctoshiftCLI + 12 diff --git a/src/OctoshiftCLI.IntegrationTests/OctoshiftCLI.IntegrationTests.csproj b/src/OctoshiftCLI.IntegrationTests/OctoshiftCLI.IntegrationTests.csproj index c7c191589..5d442b785 100644 --- a/src/OctoshiftCLI.IntegrationTests/OctoshiftCLI.IntegrationTests.csproj +++ b/src/OctoshiftCLI.IntegrationTests/OctoshiftCLI.IntegrationTests.csproj @@ -1,7 +1,8 @@ - net6.0 + net8.0 + 12 false diff --git a/src/OctoshiftCLI.Tests/OctoshiftCLI.Tests.csproj b/src/OctoshiftCLI.Tests/OctoshiftCLI.Tests.csproj index a633f8dc7..2545e0709 100644 --- a/src/OctoshiftCLI.Tests/OctoshiftCLI.Tests.csproj +++ b/src/OctoshiftCLI.Tests/OctoshiftCLI.Tests.csproj @@ -1,11 +1,9 @@ - net6.0 - + net8.0 false - - 10 + 12 diff --git a/src/ado2gh/ado2gh.csproj b/src/ado2gh/ado2gh.csproj index 96900bb4b..dda513709 100644 --- a/src/ado2gh/ado2gh.csproj +++ b/src/ado2gh/ado2gh.csproj @@ -2,9 +2,9 @@ Exe - net6.0 + net8.0 ado2gh - 10 + 12 OctoshiftCLI.AdoToGithub diff --git a/src/bbs2gh/bbs2gh.csproj b/src/bbs2gh/bbs2gh.csproj index 6a46031e8..3243d9105 100644 --- a/src/bbs2gh/bbs2gh.csproj +++ b/src/bbs2gh/bbs2gh.csproj @@ -2,9 +2,9 @@ Exe - net6.0 + net8.0 bbs2gh - 10 + 12 OctoshiftCLI.BbsToGithub diff --git a/src/gei/gei.csproj b/src/gei/gei.csproj index a3ad4e5ce..6234c928a 100644 --- a/src/gei/gei.csproj +++ b/src/gei/gei.csproj @@ -2,7 +2,9 @@ Exe - net6.0 + net8.0 + gei + 12 OctoshiftCLI.GithubEnterpriseImporter From 74484d401494351d3d595b09ae766768484740d3 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Wed, 23 Oct 2024 22:15:12 +0000 Subject: [PATCH 2/4] update global.json --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 0da62c27d..fbe458206 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.413", + "version": "8.0.403", "rollForward": "minor" } } \ No newline at end of file From 014bc059366baee4f3ff38fe61dcef1329672a6a Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Wed, 23 Oct 2024 22:30:04 +0000 Subject: [PATCH 3/4] dotnet format --- .../Services/CodeScanningAlertService.cs | 2 +- src/Octoshift/Services/OctoLogger.cs | 8 +++--- .../AbortMigrationCommandBaseTests.cs | 2 +- .../CreateTeam/CreateTeamCommandBaseTests.cs | 2 +- .../CreateTeamCommandHandlerTests.cs | 2 +- .../GenerateMannequinCsvCommandBaseTests.cs | 2 +- .../GrantMigratorRoleCommandBaseTests.cs | 2 +- .../ReclaimMannequinCommandBaseTests.cs | 2 +- .../RevokeMigratorRoleCommandBaseTests.cs | 2 +- .../WaitForMigrationCommandBaseTests.cs | 2 +- .../Octoshift/Services/GithubApiTests.cs | 10 +++---- .../Octoshift/Services/ReclaimServiceTests.cs | 28 +++++++++---------- .../AddTeamToRepoCommandTests.cs | 2 +- .../ConfigureAutoLinkCommandHandlerTests.cs | 8 +++--- .../ConfigureAutoLinkCommandTests.cs | 2 +- .../DisableRepo/DisableRepoCommandTests.cs | 2 +- .../GenerateScriptCommandTests.cs | 2 +- .../IntegrateBoardsCommandTests.cs | 2 +- .../InventoryReportCommandTests.cs | 2 +- .../Commands/LockRepo/LockRepoCommandTests.cs | 2 +- .../MigrateRepo/MigrateRepoCommandTests.cs | 2 +- .../RewirePipelineCommandTests.cs | 2 +- .../ShareServiceConnectionCommandTests.cs | 2 +- .../GenerateScriptCommandTests.cs | 2 +- .../InventoryReportCommandTests.cs | 2 +- .../MigrateRepo/MigrateRepoCommandTests.cs | 2 +- .../GenerateScriptCommandTests.cs | 2 +- .../MigrateCodeScanningAlertsCommandTests.cs | 2 +- .../MigrateOrg/MigrateOrgCommandTests.cs | 2 +- .../MigrateSecretAlertsCommandTests.cs | 2 +- src/ado2gh/Services/AdoInspectorService.cs | 2 +- 31 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/Octoshift/Services/CodeScanningAlertService.cs b/src/Octoshift/Services/CodeScanningAlertService.cs index 1ed2e4f4d..5a119fa08 100644 --- a/src/Octoshift/Services/CodeScanningAlertService.cs +++ b/src/Octoshift/Services/CodeScanningAlertService.cs @@ -109,7 +109,7 @@ protected internal virtual async Task MigrateAlerts(string sourceOrg, string sou // no reason to call the target on a dry run - there will be no alerts var targetAlerts = dryRun ? - new List() : + [] : (await _targetGithubApi.GetCodeScanningAlertsForRepository(targetOrg, targetRepo, branch)).ToList(); var successCount = 0; diff --git a/src/Octoshift/Services/OctoLogger.cs b/src/Octoshift/Services/OctoLogger.cs index 4e05f4752..d3ad02508 100644 --- a/src/Octoshift/Services/OctoLogger.cs +++ b/src/Octoshift/Services/OctoLogger.cs @@ -19,7 +19,7 @@ internal static class LogLevel public class OctoLogger { public virtual bool Verbose { get; set; } - private readonly HashSet _secrets = new(); + private readonly HashSet _secrets = []; private readonly string _logFilePath; private readonly string _verboseFilePath; private readonly bool _debugMode; @@ -31,11 +31,11 @@ public class OctoLogger private const string GENERIC_ERROR_MESSAGE = "An unexpected error happened. Please see the logs for details."; - private readonly List _redactionPatterns = new() - { + private readonly List _redactionPatterns = + [ "\\b(?<=token=)(.+?)\\b", "\\b(?<=X-Amz-Credential=)(.+?)\\b", - }; + ]; public OctoLogger() { diff --git a/src/OctoshiftCLI.Tests/Octoshift/Commands/AbortMigration/AbortMigrationCommandBaseTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Commands/AbortMigration/AbortMigrationCommandBaseTests.cs index dc334541c..306c50874 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Commands/AbortMigration/AbortMigrationCommandBaseTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Commands/AbortMigration/AbortMigrationCommandBaseTests.cs @@ -12,7 +12,7 @@ public class AbortMigrationCommandBaseTests private readonly Mock _mockGithubApiFactory = new(); private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly AbortMigrationCommandBase _command = new(); + private readonly AbortMigrationCommandBase _command = []; private const string REPO_MIGRATION_ID = "RM_MIGRATION_ID"; diff --git a/src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandBaseTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandBaseTests.cs index dd901520b..907c176ae 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandBaseTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandBaseTests.cs @@ -14,7 +14,7 @@ public class CreateTeamCommandTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly CreateTeamCommandBase _command = new(); + private readonly CreateTeamCommandBase _command = []; public CreateTeamCommandTests() { diff --git a/src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandHandlerTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandHandlerTests.cs index b90ba181c..9edd1f074 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandHandlerTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandHandlerTests.cs @@ -18,7 +18,7 @@ public class CreateTeamCommandHandlerTests private const string GITHUB_ORG = "FooOrg"; private const string TEAM_NAME = "foo-team"; private const string IDP_GROUP = "foo-group"; - private readonly List TEAM_MEMBERS = new() { "dylan", "dave" }; + private readonly List TEAM_MEMBERS = ["dylan", "dave"]; private const int IDP_GROUP_ID = 42; private const string TEAM_SLUG = "foo-slug"; diff --git a/src/OctoshiftCLI.Tests/Octoshift/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandBaseTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandBaseTests.cs index 6e94167fa..85870b378 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandBaseTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandBaseTests.cs @@ -12,7 +12,7 @@ public class GenerateMannequinCsvCommandBaseTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly Mock _mockGithubApiFactory = new(); private readonly ServiceProvider _serviceProvider; - private readonly GenerateMannequinCsvCommandBase _command = new(); + private readonly GenerateMannequinCsvCommandBase _command = []; private const string GITHUB_ORG = "FooOrg"; public GenerateMannequinCsvCommandBaseTests() diff --git a/src/OctoshiftCLI.Tests/Octoshift/Commands/GrantMigratorRole/GrantMigratorRoleCommandBaseTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Commands/GrantMigratorRole/GrantMigratorRoleCommandBaseTests.cs index c5580c77e..f34501716 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Commands/GrantMigratorRole/GrantMigratorRoleCommandBaseTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Commands/GrantMigratorRole/GrantMigratorRoleCommandBaseTests.cs @@ -14,7 +14,7 @@ public class GrantMigratorRoleCommandBaseTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly GrantMigratorRoleCommandBase _command = new(); + private readonly GrantMigratorRoleCommandBase _command = []; public GrantMigratorRoleCommandBaseTests() { diff --git a/src/OctoshiftCLI.Tests/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandBaseTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandBaseTests.cs index d3cc3ecbe..c8cfe0095 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandBaseTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandBaseTests.cs @@ -13,7 +13,7 @@ public class ReclaimMannequinCommandBaseTests private readonly Mock _mockConfirmationService = TestHelpers.CreateMock(); private readonly Mock _mockGithubApiFactory = new(); private readonly ServiceProvider _serviceProvider; - private readonly ReclaimMannequinCommandBase _command = new(); + private readonly ReclaimMannequinCommandBase _command = []; private const string GITHUB_ORG = "FooOrg"; diff --git a/src/OctoshiftCLI.Tests/Octoshift/Commands/RevokeMigratorRole/RevokeMigratorRoleCommandBaseTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Commands/RevokeMigratorRole/RevokeMigratorRoleCommandBaseTests.cs index 87437cf5b..3095958b2 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Commands/RevokeMigratorRole/RevokeMigratorRoleCommandBaseTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Commands/RevokeMigratorRole/RevokeMigratorRoleCommandBaseTests.cs @@ -14,7 +14,7 @@ public class RevokeMigratorRoleCommandBaseTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly RevokeMigratorRoleCommandBase _command = new(); + private readonly RevokeMigratorRoleCommandBase _command = []; public RevokeMigratorRoleCommandBaseTests() { diff --git a/src/OctoshiftCLI.Tests/Octoshift/Commands/WaitForMigration/WaitForMigrationCommandBaseTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Commands/WaitForMigration/WaitForMigrationCommandBaseTests.cs index 562e9305f..ae3d2f2a7 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Commands/WaitForMigration/WaitForMigrationCommandBaseTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Commands/WaitForMigration/WaitForMigrationCommandBaseTests.cs @@ -13,7 +13,7 @@ public class WaitForMigrationCommandBaseTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly Mock _mockWarningsCountLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly WaitForMigrationCommandBase _command = new(); + private readonly WaitForMigrationCommandBase _command = []; private const string REPO_MIGRATION_ID = "RM_MIGRATION_ID"; public WaitForMigrationCommandBaseTests() diff --git a/src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs index 56d93ae6e..bd87b8b03 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs @@ -1994,20 +1994,20 @@ ... on User { { CreateAttributionInvitation = null }, - Errors = new Collection{new ErrorData + Errors = [new ErrorData { Type = "UNPROCESSABLE", Message = "Target must be a member of the octocat organization", - Path = new Collection { "createAttributionInvitation" }, - Locations = new Collection { + Path = ["createAttributionInvitation"], + Locations = [ new Location() { Line = 2, Column = 14 } - } + ] } - } + ] }; _githubClientMock diff --git a/src/OctoshiftCLI.Tests/Octoshift/Services/ReclaimServiceTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Services/ReclaimServiceTests.cs index b8caa74f2..b1ae4c4a2 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Services/ReclaimServiceTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Services/ReclaimServiceTests.cs @@ -605,13 +605,13 @@ public async Task ReclaimMannequinsSkipInvitation_No_EMU_Throws_Error_Fails_Fast var reclaimMannequinResponse = new ReattributeMannequinToUserResult() { - Errors = new Collection() - { + Errors = + [ new ErrorData() { Message = "is not an Enterprise Managed Users (EMU) organization" } - } + ] }; _mockGithubApi.Setup(x => x.GetOrganizationId(TARGET_ORG).Result).Returns(ORG_ID); @@ -941,14 +941,14 @@ public async Task ReclaimMannequin_FailedToReclaim_LogsError_Throws_OctoshiftCli { CreateAttributionInvitation = null }, - Errors = new Collection{new ErrorData + Errors = [new ErrorData { Type = "UNPROCESSABLE", Message = failureMessage, - Path = new Collection { "createAttributionInvitation" }, - Locations = new Collection { new Location() { Line = 2, Column = 14 } } + Path = ["createAttributionInvitation"], + Locations = [new Location() { Line = 2, Column = 14 }] } - } + ] }; _mockGithubApi.Setup(x => x.GetOrganizationId(TARGET_ORG).Result).Returns(ORG_ID); @@ -982,14 +982,14 @@ public async Task ReclaimMannequin_TwoMannequins_FailedToReclaimOne_LogsError_Th { CreateAttributionInvitation = null }, - Errors = new Collection{new ErrorData + Errors = [new ErrorData { Type = "UNPROCESSABLE", Message = failureMessage, - Path = new Collection { "createAttributionInvitation" }, - Locations = new Collection { new Location() { Line = 2, Column = 14 } } + Path = ["createAttributionInvitation"], + Locations = [new Location() { Line = 2, Column = 14 }] } - } + ] }; var reclaimMannequinResponse2 = new CreateAttributionInvitationResult() @@ -1107,13 +1107,13 @@ public async Task ReclaimMannequinSkipInvitation_No_EMU_Throws_Error_Fails_Fast( var reclaimMannequinResponse = new ReattributeMannequinToUserResult() { - Errors = new Collection() - { + Errors = + [ new ErrorData() { Message = "is not an Enterprise Managed Users (EMU) organization" } - } + ] }; _mockGithubApi.Setup(x => x.GetOrganizationId(TARGET_ORG).Result).Returns(ORG_ID); diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommandTests.cs index 288288d42..a0f421e12 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommandTests.cs @@ -15,7 +15,7 @@ public class AddTeamToRepoCommandTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly AddTeamToRepoCommand _command = new(); + private readonly AddTeamToRepoCommand _command = []; public AddTeamToRepoCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/ConfigureAutoLinkCommand/ConfigureAutoLinkCommandHandlerTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/ConfigureAutoLinkCommand/ConfigureAutoLinkCommandHandlerTests.cs index 0b206877d..d13f43da7 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/ConfigureAutoLinkCommand/ConfigureAutoLinkCommandHandlerTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/ConfigureAutoLinkCommand/ConfigureAutoLinkCommandHandlerTests.cs @@ -31,7 +31,7 @@ public ConfigureAutoLinkCommandHandlerTests() public async Task Happy_Path() { _mockGithubApi.Setup(x => x.GetAutoLinks(It.IsAny(), It.IsAny())) - .ReturnsAsync(new List<(int Id, string KeyPrefix, string UrlTemplate)>()); + .ReturnsAsync([]); var args = new ConfigureAutoLinkCommandArgs { @@ -77,10 +77,10 @@ public async Task Idempotency_AutoLink_Exists() public async Task Idempotency_KeyPrefix_Exists() { _mockGithubApi.Setup(x => x.GetAutoLinks(It.IsAny(), It.IsAny())) - .ReturnsAsync(new List<(int Id, string KeyPrefix, string UrlTemplate)> - { + .ReturnsAsync( + [ (1, KEY_PREFIX, "SomethingElse"), - }); + ]); var actualLogOutput = new List(); _mockOctoLogger.Setup(m => m.LogInformation(It.IsAny())).Callback(s => actualLogOutput.Add(s)); diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/ConfigureAutoLinkCommand/ConfigureAutoLinkCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/ConfigureAutoLinkCommand/ConfigureAutoLinkCommandTests.cs index cb44fdd49..259b12422 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/ConfigureAutoLinkCommand/ConfigureAutoLinkCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/ConfigureAutoLinkCommand/ConfigureAutoLinkCommandTests.cs @@ -14,7 +14,7 @@ public class ConfigureAutoLinkCommandTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly ConfigureAutoLinkCommand _command = new(); + private readonly ConfigureAutoLinkCommand _command = []; public ConfigureAutoLinkCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/DisableRepo/DisableRepoCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/DisableRepo/DisableRepoCommandTests.cs index 20a1ab375..940b304a8 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/DisableRepo/DisableRepoCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/DisableRepo/DisableRepoCommandTests.cs @@ -13,7 +13,7 @@ public class DisableRepoCommandTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly DisableRepoCommand _command = new(); + private readonly DisableRepoCommand _command = []; public DisableRepoCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs index b06d0d323..2bc05d57c 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs @@ -18,7 +18,7 @@ public class GenerateScriptCommandTests private readonly Mock _mockVersionProvider = new(); private readonly ServiceProvider _serviceProvider; - private readonly GenerateScriptCommand _command = new(); + private readonly GenerateScriptCommand _command = []; public GenerateScriptCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/IntegrateBoards/IntegrateBoardsCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/IntegrateBoards/IntegrateBoardsCommandTests.cs index 45cc10269..fb9b101d7 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/IntegrateBoards/IntegrateBoardsCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/IntegrateBoards/IntegrateBoardsCommandTests.cs @@ -14,7 +14,7 @@ public class IntegrateBoardsCommandTests private readonly Mock _mockEnvironmentVariableProvider = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly IntegrateBoardsCommand _command = new(); + private readonly IntegrateBoardsCommand _command = []; public IntegrateBoardsCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/InventoryReport/InventoryReportCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/InventoryReport/InventoryReportCommandTests.cs index c1d9fc94e..9bfd92ffd 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/InventoryReport/InventoryReportCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/InventoryReport/InventoryReportCommandTests.cs @@ -19,7 +19,7 @@ public class InventoryReportCommandTests private readonly Mock _mockPipelinesCsvGeneratorService = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly InventoryReportCommand _command = new(); + private readonly InventoryReportCommand _command = []; public InventoryReportCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/LockRepo/LockRepoCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/LockRepo/LockRepoCommandTests.cs index 09a1a7b31..f75658e5c 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/LockRepo/LockRepoCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/LockRepo/LockRepoCommandTests.cs @@ -13,7 +13,7 @@ public class LockRepoCommandTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly LockRepoCommand _command = new(); + private readonly LockRepoCommand _command = []; public LockRepoCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs index 9ad54d5aa..b244a6d2f 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs @@ -16,7 +16,7 @@ public class MigrateRepoCommandTests private readonly Mock _warningsCountLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly MigrateRepoCommand _command = new(); + private readonly MigrateRepoCommand _command = []; public MigrateRepoCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/RewirePipeline/RewirePipelineCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/RewirePipeline/RewirePipelineCommandTests.cs index 16cac8566..cb292c634 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/RewirePipeline/RewirePipelineCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/RewirePipeline/RewirePipelineCommandTests.cs @@ -14,7 +14,7 @@ public class RewirePipelineCommandTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly RewirePipelineCommand _command = new(); + private readonly RewirePipelineCommand _command = []; public RewirePipelineCommandTests() { diff --git a/src/OctoshiftCLI.Tests/ado2gh/Commands/ShareServiceConnection/ShareServiceConnectionCommandTests.cs b/src/OctoshiftCLI.Tests/ado2gh/Commands/ShareServiceConnection/ShareServiceConnectionCommandTests.cs index 3b55bc393..de5d490b3 100644 --- a/src/OctoshiftCLI.Tests/ado2gh/Commands/ShareServiceConnection/ShareServiceConnectionCommandTests.cs +++ b/src/OctoshiftCLI.Tests/ado2gh/Commands/ShareServiceConnection/ShareServiceConnectionCommandTests.cs @@ -14,7 +14,7 @@ public class ShareServiceConnectionCommandTests private readonly Mock _mockOctoLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly ShareServiceConnectionCommand _command = new(); + private readonly ShareServiceConnectionCommand _command = []; public ShareServiceConnectionCommandTests() { diff --git a/src/OctoshiftCLI.Tests/bbs2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs b/src/OctoshiftCLI.Tests/bbs2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs index db247883e..8f4f6f202 100644 --- a/src/OctoshiftCLI.Tests/bbs2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs +++ b/src/OctoshiftCLI.Tests/bbs2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs @@ -20,7 +20,7 @@ public class GenerateScriptCommandTests private readonly Mock _mockFileSystemProvider = TestHelpers.CreateMock(); private readonly Mock _mockVersionProvider = new(); - private readonly GenerateScriptCommand _command = new(); + private readonly GenerateScriptCommand _command = []; public GenerateScriptCommandTests() { diff --git a/src/OctoshiftCLI.Tests/bbs2gh/Commands/InventoryReport/InventoryReportCommandTests.cs b/src/OctoshiftCLI.Tests/bbs2gh/Commands/InventoryReport/InventoryReportCommandTests.cs index 95cd7d0ba..44cffd463 100644 --- a/src/OctoshiftCLI.Tests/bbs2gh/Commands/InventoryReport/InventoryReportCommandTests.cs +++ b/src/OctoshiftCLI.Tests/bbs2gh/Commands/InventoryReport/InventoryReportCommandTests.cs @@ -17,7 +17,7 @@ public class InventoryReportCommandTests private readonly Mock _mockReposCsvGeneratorService = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly InventoryReportCommand _command = new(); + private readonly InventoryReportCommand _command = []; public InventoryReportCommandTests() { diff --git a/src/OctoshiftCLI.Tests/bbs2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs b/src/OctoshiftCLI.Tests/bbs2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs index c20c5e5fc..f438d6c09 100644 --- a/src/OctoshiftCLI.Tests/bbs2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs +++ b/src/OctoshiftCLI.Tests/bbs2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs @@ -36,7 +36,7 @@ public class MigrateRepoCommandTests private readonly Mock _mockAzureApiFactory = new(); private readonly Mock _warningsCountLogger = TestHelpers.CreateMock(); - private readonly MigrateRepoCommand _command = new(); + private readonly MigrateRepoCommand _command = []; public MigrateRepoCommandTests() { diff --git a/src/OctoshiftCLI.Tests/gei/Commands/GenerateScript/GenerateScriptCommandTests.cs b/src/OctoshiftCLI.Tests/gei/Commands/GenerateScript/GenerateScriptCommandTests.cs index a24ff8de7..49454db20 100644 --- a/src/OctoshiftCLI.Tests/gei/Commands/GenerateScript/GenerateScriptCommandTests.cs +++ b/src/OctoshiftCLI.Tests/gei/Commands/GenerateScript/GenerateScriptCommandTests.cs @@ -18,7 +18,7 @@ public class GenerateScriptCommandTests private readonly Mock _mockGhesVersionCheckerFactory = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly GenerateScriptCommand _command = new(); + private readonly GenerateScriptCommand _command = []; public GenerateScriptCommandTests() { diff --git a/src/OctoshiftCLI.Tests/gei/Commands/MigrateCodeScanningAlerts/MigrateCodeScanningAlertsCommandTests.cs b/src/OctoshiftCLI.Tests/gei/Commands/MigrateCodeScanningAlerts/MigrateCodeScanningAlertsCommandTests.cs index fd8e50e1d..2ebbb75d2 100644 --- a/src/OctoshiftCLI.Tests/gei/Commands/MigrateCodeScanningAlerts/MigrateCodeScanningAlertsCommandTests.cs +++ b/src/OctoshiftCLI.Tests/gei/Commands/MigrateCodeScanningAlerts/MigrateCodeScanningAlertsCommandTests.cs @@ -15,7 +15,7 @@ public class MigrateCodeScanningAlertsCommandTests private readonly Mock _mockCodeScanningAlertServiceFactory = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly MigrateCodeScanningAlertsCommand _command = new(); + private readonly MigrateCodeScanningAlertsCommand _command = []; public MigrateCodeScanningAlertsCommandTests() { diff --git a/src/OctoshiftCLI.Tests/gei/Commands/MigrateOrg/MigrateOrgCommandTests.cs b/src/OctoshiftCLI.Tests/gei/Commands/MigrateOrg/MigrateOrgCommandTests.cs index 488553e26..f806c1521 100644 --- a/src/OctoshiftCLI.Tests/gei/Commands/MigrateOrg/MigrateOrgCommandTests.cs +++ b/src/OctoshiftCLI.Tests/gei/Commands/MigrateOrg/MigrateOrgCommandTests.cs @@ -16,7 +16,7 @@ public class MigrateOrgCommandTests private readonly Mock _warningsCountLogger = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly MigrateOrgCommand _command = new(); + private readonly MigrateOrgCommand _command = []; public MigrateOrgCommandTests() { diff --git a/src/OctoshiftCLI.Tests/gei/Commands/MigrateSecretAlerts/MigrateSecretAlertsCommandTests.cs b/src/OctoshiftCLI.Tests/gei/Commands/MigrateSecretAlerts/MigrateSecretAlertsCommandTests.cs index ff553caf7..da2f68d12 100644 --- a/src/OctoshiftCLI.Tests/gei/Commands/MigrateSecretAlerts/MigrateSecretAlertsCommandTests.cs +++ b/src/OctoshiftCLI.Tests/gei/Commands/MigrateSecretAlerts/MigrateSecretAlertsCommandTests.cs @@ -15,7 +15,7 @@ public class MigrateSecretAlertsCommandTests private readonly Mock _mockSecretScanningAlertServiceFactory = TestHelpers.CreateMock(); private readonly ServiceProvider _serviceProvider; - private readonly MigrateSecretAlertsCommand _command = new(); + private readonly MigrateSecretAlertsCommand _command = []; public MigrateSecretAlertsCommandTests() { diff --git a/src/ado2gh/Services/AdoInspectorService.cs b/src/ado2gh/Services/AdoInspectorService.cs index f076ad5bc..8fea75913 100644 --- a/src/ado2gh/Services/AdoInspectorService.cs +++ b/src/ado2gh/Services/AdoInspectorService.cs @@ -168,7 +168,7 @@ public virtual async Task> GetTeamProjects(string org) { if (!_teamProjects.TryGetValue(org, out var teamProjects)) { - teamProjects = TeamProjectFilter.HasValue() ? new List() { TeamProjectFilter } : (await _adoApi.GetTeamProjects(org)).ToList(); + teamProjects = TeamProjectFilter.HasValue() ? [TeamProjectFilter] : (await _adoApi.GetTeamProjects(org)).ToList(); _teamProjects.Add(org, teamProjects); } From 3ed6a7c8e34d1c4b075da139d410acef6f077768 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Wed, 23 Oct 2024 22:34:18 +0000 Subject: [PATCH 4/4] dotnet format (again) --- src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs | 3 +-- .../Octoshift/Services/ReclaimServiceTests.cs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs index bd87b8b03..f8a2a5b73 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; using System.Net; using System.Net.Http; @@ -2006,7 +2005,7 @@ ... on User { Column = 14 } ] - } + } ] }; diff --git a/src/OctoshiftCLI.Tests/Octoshift/Services/ReclaimServiceTests.cs b/src/OctoshiftCLI.Tests/Octoshift/Services/ReclaimServiceTests.cs index b1ae4c4a2..96b8cf594 100644 --- a/src/OctoshiftCLI.Tests/Octoshift/Services/ReclaimServiceTests.cs +++ b/src/OctoshiftCLI.Tests/Octoshift/Services/ReclaimServiceTests.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.ObjectModel; using System.Threading.Tasks; using FluentAssertions; using Moq; @@ -947,7 +946,7 @@ public async Task ReclaimMannequin_FailedToReclaim_LogsError_Throws_OctoshiftCli Message = failureMessage, Path = ["createAttributionInvitation"], Locations = [new Location() { Line = 2, Column = 14 }] - } + } ] }; @@ -988,7 +987,7 @@ public async Task ReclaimMannequin_TwoMannequins_FailedToReclaimOne_LogsError_Th Message = failureMessage, Path = ["createAttributionInvitation"], Locations = [new Location() { Line = 2, Column = 14 }] - } + } ] };