From 8af2ff539e7f0232caa0977fcdecdb3547e369f6 Mon Sep 17 00:00:00 2001 From: Dominion Date: Mon, 12 Jun 2023 20:43:29 -0400 Subject: [PATCH 01/10] Replace ifs with ArgumentNullException.ThrowIfNull --- .../Components/Byond/ByondInstallerBase.cs | 3 +- .../Components/Byond/ByondManager.cs | 6 +- .../Components/Byond/PosixByondInstaller.cs | 15 ++--- .../Components/Byond/WindowsByondInstaller.cs | 9 +-- .../Components/Chat/ChatManager.cs | 18 ++---- .../Components/Chat/ChatTrackingContext.cs | 3 +- .../Chat/Providers/DiscordProvider.cs | 24 +++----- .../Components/Chat/Providers/IrcProvider.cs | 18 ++---- .../Chat/Providers/ProviderFactory.cs | 3 +- .../Components/Deployment/DmbFactory.cs | 6 +- .../Components/Deployment/DreamMaker.cs | 9 +-- .../Remote/GitHubRemoteDeploymentManager.cs | 18 ++---- .../Remote/GitLabRemoteDeploymentManager.cs | 9 +-- .../Remote/RemoteDeploymentManagerFactory.cs | 6 +- .../Components/Events/EventConsumer.cs | 6 +- .../Components/InstanceFactory.cs | 9 +-- .../Components/InstanceManager.cs | 18 ++---- .../Interop/Bridge/RuntimeInformation.cs | 3 +- .../Repository/GitHubRemoteFeatures.cs | 3 +- .../Repository/GitRemoteFeaturesBase.cs | 9 +-- .../Repository/GitRemoteFeaturesFactory.cs | 6 +- .../Components/Repository/LibGit2Commands.cs | 6 +- .../Repository/LibGit2RepositoryFactory.cs | 6 +- .../Components/Repository/Repository.cs | 57 +++++++------------ .../Repository/RepositoryManager.cs | 6 +- .../Components/Session/ReattachInformation.cs | 3 +- .../Components/Session/SessionController.cs | 12 ++-- .../Session/SessionControllerFactory.cs | 3 +- .../Components/Session/SessionPersistor.cs | 3 +- .../Components/Session/TopicClientFactory.cs | 3 +- .../Components/StaticFiles/Configuration.cs | 3 +- .../Components/Watchdog/WatchdogBase.cs | 6 +- .../Configuration/FileLoggingConfiguration.cs | 9 +-- .../Configuration/GeneralConfiguration.cs | 3 +- .../Configuration/OAuthConfigurationBase.cs | 3 +- .../Controllers/AdministrationController.cs | 6 +- .../Controllers/ApiController.cs | 12 ++-- .../Controllers/BridgeController.cs | 3 +- .../Controllers/ByondController.cs | 6 +- .../Controllers/ChatController.cs | 6 +- .../ComponentInterfacingController.cs | 6 +- .../Controllers/ConfigurationController.cs | 9 +-- .../Controllers/ControlPanelController.cs | 3 +- .../Controllers/DreamDaemonController.cs | 3 +- .../Controllers/DreamMakerController.cs | 3 +- .../Controllers/InstanceController.cs | 6 +- .../InstancePermissionSetController.cs | 6 +- .../Controllers/LimitedStreamResult.cs | 3 +- .../LimitedStreamResultExecutor.cs | 6 +- .../Controllers/RepositoryController.cs | 6 +- .../Controllers/SwarmController.cs | 9 +-- .../Controllers/UserController.cs | 6 +- .../Controllers/UserGroupController.cs | 6 +- src/Tgstation.Server.Host/Core/Application.cs | 18 ++---- .../Core/ServerPortProivder.cs | 3 +- .../Core/ServerUpdater.cs | 9 +-- .../Database/DatabaseConnectionFactory.cs | 3 +- .../Database/DatabaseContext.cs | 12 ++-- .../Database/DatabaseContextFactory.cs | 3 +- .../Database/DatabaseSeeder.cs | 9 +-- .../20180906135553_MSInitialCreate.cs | 6 +- .../20180906143029_MYInitialCreate.cs | 6 +- .../20180918020726_MYAddMinimumSecurity.cs | 6 +- .../20180918021228_MSAddMinimumSecurity.cs | 6 +- ...18204520_MYNullableAndForeignKeyCleanup.cs | 6 +- ...18205224_MSNullableAndForeignKeyCleanup.cs | 6 +- ...0926033145_MSReattachCompileJobRequired.cs | 6 +- ...0926034014_MYReattachCompileJobRequired.cs | 6 +- ...0181124231534_MSToggleTestmergeComments.cs | 6 +- ...0181124231549_MYToggleTestmergeComments.cs | 6 +- .../20190219041825_MSFixRevInfoIndex.cs | 6 +- .../20190219042440_MYFixRevInfoIndex.cs | 6 +- ...170252_MSAddChatBotReconnectionInterval.cs | 6 +- ...171159_MYAddChatBotReconnectionInterval.cs | 6 +- .../20200411164808_MSTonsOfValidation.cs | 6 +- .../20200411170010_MYTonsOfValidation.cs | 6 +- .../20200420175359_MSLimitsOnChat.cs | 6 +- .../20200420181015_MYLimitsOnChat.cs | 6 +- ...00422001202_MSAddCompileJobDMApiVersion.cs | 6 +- ...00422010115_MYAddCompileJobDMApiVersion.cs | 6 +- ...200423052142_MSKillJsonsAddDMApiVersion.cs | 6 +- ...200423052709_MYKillJsonsAddDMApiVersion.cs | 6 +- .../20200425024433_MSAddJobErrorCodes.cs | 6 +- .../20200425024953_MYAddJobErrorCodes.cs | 6 +- .../20200427173852_MSFixCascadingDelete.cs | 6 +- .../20200427180159_MYFixCascadingDelete.cs | 6 +- .../Migrations/20200427180904_SLRebuild.cs | 6 +- .../20200511005957_MSAddHeartbeat.cs | 6 +- .../20200511011048_MYAddHeartbeat.cs | 6 +- .../20200511012117_SLAddHeartbeat.cs | 6 +- .../20200511162912_SLRemoveSoftColumns.cs | 6 +- .../20200512181801_MSRemoveSoftColumns.cs | 6 +- .../20200512182535_MYRemoveSoftColumns.cs | 6 +- .../Migrations/20200516111712_PGCreate.cs | 6 +- .../20200529171541_MYFixForeignKey.cs | 6 +- .../20200616175424_MSTopicTimeout.cs | 6 +- .../20200616175535_MYTopicTimeout.cs | 6 +- .../20200616180742_SLTopicTimeout.cs | 6 +- .../20200616180842_PGTopicTimeout.cs | 6 +- ...0629184803_MSRemoveExperimentalWatchdog.cs | 6 +- ...0629184843_MYRemoveExperimentalWatchdog.cs | 6 +- ...0629184928_PGRemoveExperimentalWatchdog.cs | 6 +- ...0629185014_SLRemoveExperimentalWatchdog.cs | 6 +- .../20200705163512_MSAllowNullDMApi.cs | 6 +- .../20200705163547_MYAllowNullDMApi.cs | 6 +- .../20200705163624_PGAllowNullDMApi.cs | 6 +- .../20200705163700_SLAllowNullDMApi.cs | 6 +- .../20200807213255_MSAddDeploymentColumns.cs | 6 +- .../20200807213742_MYAddDeploymentColumns.cs | 6 +- .../20200807214330_PGAddDeploymentColumns.cs | 6 +- .../20200807214754_SLAddDeploymentColumns.cs | 6 +- ...01106082502_MSAddAdditionalDDParameters.cs | 6 +- ...01106082556_MYAddAdditionalDDParameters.cs | 6 +- ...01106082653_PGAddAdditionalDDParameters.cs | 6 +- ...01106082741_SLAddAdditionalDDParameters.cs | 6 +- .../20201122231219_MSAddOAuthConnections.cs | 6 +- .../20201122231327_MYAddOAuthConnections.cs | 6 +- .../20201122231443_PGAddOAuthConnections.cs | 6 +- .../20201122231546_SLAddOAuthConnections.cs | 6 +- ...201209194250_MSGenericTestMergingUpdate.cs | 6 +- ...201209194348_MYGenericTestMergingUpdate.cs | 6 +- ...201209194500_PGGenericTestMergingUpdate.cs | 6 +- ...201209194554_SLGenericTestMergingUpdate.cs | 6 +- .../20201214181824_MSAddUserGroups.cs | 6 +- .../20201214181914_MYAddUserGroups.cs | 6 +- .../20201214182008_PGAddUserGroups.cs | 6 +- .../20201214182101_SLAddUserGroups.cs | 6 +- .../20201222175310_MSAddSwarmIdentifer.cs | 6 +- .../20201222175357_MYAddSwarmIdentifer.cs | 6 +- .../20201222175444_PGAddSwarmIdentifer.cs | 6 +- .../20201222175532_SLAddSwarmIdentifer.cs | 6 +- .../20210112154040_MSAddRevInfoTimestamp.cs | 6 +- .../20210112154123_MYAddRevInfoTimestamp.cs | 6 +- .../20210112154203_PGAddRevInfoTimestamp.cs | 6 +- .../20210112154243_SLAddRevInfoTimestamp.cs | 6 +- .../20210211173222_MSTruncateInstanceNames.cs | 6 +- .../20210211173316_MYTruncateInstanceNames.cs | 6 +- .../20210211173407_PGTruncateInstanceNames.cs | 6 +- ...210825163342_MSAddDreamDaemonVisibility.cs | 6 +- ...210825163433_MYAddDreamDaemonVisibility.cs | 6 +- ...210825163520_PGAddDreamDaemonVisibility.cs | 6 +- ...210825163612_SLAddDreamDaemonVisibility.cs | 6 +- .../20210826213501_MSAddDeploymentTimeout.cs | 6 +- .../20210826213652_MYAddDeploymentTimeout.cs | 6 +- .../20210826213805_PGAddDeploymentTimeout.cs | 6 +- .../20210826214006_SLAddDeploymentTimeout.cs | 6 +- .../20210828183711_MSAddUpdateSubmodules.cs | 6 +- .../20210828183801_MYAddUpdateSubmodules.cs | 6 +- .../20210828183859_PGAddUpdateSubmodules.cs | 6 +- .../20210828183954_SLAddUpdateSubmodules.cs | 6 +- ...20811162903_MSAddDumpOnHeartbeatRestart.cs | 6 +- ...20811163039_MYAddDumpOnHeartbeatRestart.cs | 6 +- ...20811163234_PGAddDumpOnHeartbeatRestart.cs | 6 +- ...20811163432_SLAddDumpOnHeartbeatRestart.cs | 6 +- .../20220814142133_MSAddProfiler.cs | 6 +- .../20220814142253_MYAddProfiler.cs | 6 +- .../20220814142401_PGAddProfiler.cs | 6 +- .../20220814142535_SLAddProfiler.cs | 6 +- ...0230331220749_MSAddDreamDaemonLogOutput.cs | 6 +- ...0230331221032_PGAddDreamDaemonLogOutput.cs | 6 +- ...0230331221156_SLAddDreamDaemonLogOutput.cs | 6 +- ...0230401210715_MYAddDreamDaemonLogOutput.cs | 6 +- ...0623_MSAddReattachInfoInitialCompileJob.cs | 6 +- ...0737_MYAddReattachInfoInitialCompileJob.cs | 6 +- ...0832_PGAddReattachInfoInitialCompileJob.cs | 6 +- ...0941_SLAddReattachInfoInitialCompileJob.cs | 6 +- .../20230520203236_MSAddSystemChannels.cs | 6 +- .../20230520203305_MYAddSystemChannels.cs | 6 +- .../20230520203332_PGAddSystemChannels.cs | 6 +- .../20230520203402_SLAddSystemChannels.cs | 6 +- .../Database/MySqlDatabaseContext.cs | 6 +- .../Database/PostgresSqlDatabaseContext.cs | 6 +- .../Database/SqlServerDatabaseContext.cs | 6 +- .../Database/SqliteDatabaseContext.cs | 6 +- .../ApplicationBuilderExtensions.cs | 24 +++----- .../Extensions/ChatChannelExtensions.cs | 3 +- .../Extensions/Converters/VersionConverter.cs | 9 +-- .../FileTransferStreamHandlerExtensions.cs | 6 +- .../GeneralConfigurationExtensions.cs | 3 +- .../Extensions/HostBuilderExtensions.cs | 3 +- .../Extensions/ResultExtensions.cs | 3 +- .../Extensions/ServiceCollectionExtensions.cs | 15 ++--- .../Extensions/TaskExtensions.cs | 6 +- .../Extensions/WebHostBuilderExtensions.cs | 12 ++-- .../IO/DefaultIOManager.cs | 21 +++---- .../IO/FileDownloader.cs | 3 +- .../IO/PosixPostWriteHandler.cs | 6 +- .../IO/PosixSymlinkFactory.cs | 6 +- .../IO/ResolvingIOManager.cs | 6 +- .../IO/SynchronousIOManager.cs | 12 ++-- .../IO/WindowsPostWriteHandler.cs | 6 +- .../IO/WindowsSymlinkFactory.cs | 6 +- src/Tgstation.Server.Host/Jobs/JobService.cs | 18 ++---- .../Models/ReattachInformationBase.cs | 3 +- .../Security/ClaimsInjector.cs | 3 +- .../Security/CryptographySuite.cs | 12 ++-- .../Security/IdentityCache.cs | 9 +-- .../Security/IdentityCacheObject.cs | 6 +- .../Security/OAuth/GitHubOAuthValidator.cs | 3 +- .../Security/OAuth/OAuthProviders.cs | 3 +- .../Security/TokenFactory.cs | 9 +-- .../Security/WindowsSystemIdentity.cs | 3 +- .../Security/WindowsSystemIdentityFactory.cs | 9 +-- src/Tgstation.Server.Host/Server.cs | 9 +-- src/Tgstation.Server.Host/ServerFactory.cs | 3 +- .../Setup/PostSetupServices.cs | 3 +- .../Setup/SetupApplication.cs | 9 +-- .../Setup/SetupWizard.cs | 3 +- .../Swarm/SwarmService.cs | 15 ++--- .../Swarm/SwarmUpdateOperation.cs | 3 +- .../System/PosixProcessFeatures.cs | 6 +- src/Tgstation.Server.Host/System/Process.cs | 3 +- .../System/ProcessExecutor.cs | 9 +-- .../System/WindowsNetworkPromptReaper.cs | 3 +- .../System/WindowsProcessFeatures.cs | 6 +- .../Transfer/FileTransferService.cs | 9 +-- .../Transfer/FileUploadProvider.cs | 3 +- .../Utils/GitHub/GitHubService.cs | 48 ++++++---------- .../Utils/OpenApiEnumVarNamesExtension.cs | 6 +- .../Utils/ReferenceCounter.cs | 6 +- .../Utils/SemaphoreSlimContext.cs | 3 +- .../Utils/SwaggerConfiguration.cs | 24 +++----- .../Live/DummyChatProvider.cs | 15 ++--- .../Live/DummyChatProviderFactory.cs | 3 +- .../Live/DummyGitHubServiceFactory.cs | 3 +- 225 files changed, 530 insertions(+), 1060 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Byond/ByondInstallerBase.cs b/src/Tgstation.Server.Host/Components/Byond/ByondInstallerBase.cs index 8110731d9a..2291a9a5f9 100644 --- a/src/Tgstation.Server.Host/Components/Byond/ByondInstallerBase.cs +++ b/src/Tgstation.Server.Host/Components/Byond/ByondInstallerBase.cs @@ -91,8 +91,7 @@ namespace Tgstation.Server.Host.Components.Byond /// public async Task DownloadVersion(Version version, CancellationToken cancellationToken) { - if (version == null) - throw new ArgumentNullException(nameof(version)); + ArgumentNullException.ThrowIfNull(version); Logger.LogTrace("Downloading BYOND version {major}.{minor}...", version.Major, version.Minor); var url = String.Format(CultureInfo.InvariantCulture, ByondRevisionsUrlTemplate, version.Major, version.Minor); diff --git a/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs b/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs index b699e2e9ba..085a5ce2aa 100644 --- a/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs +++ b/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs @@ -105,8 +105,7 @@ namespace Tgstation.Server.Host.Components.Byond /// The to validate. static void CheckVersionParameter(Version version) { - if (version == null) - throw new ArgumentNullException(nameof(version)); + ArgumentNullException.ThrowIfNull(version); if (version.Build == 0) throw new ArgumentException("version.Build cannot be 0!", nameof(version)); @@ -207,8 +206,7 @@ namespace Tgstation.Server.Host.Components.Byond /// public async Task DeleteVersion(JobProgressReporter progressReporter, Version version, CancellationToken cancellationToken) { - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(progressReporter); CheckVersionParameter(version); diff --git a/src/Tgstation.Server.Host/Components/Byond/PosixByondInstaller.cs b/src/Tgstation.Server.Host/Components/Byond/PosixByondInstaller.cs index ddd012ab0c..cdcb13eb7b 100644 --- a/src/Tgstation.Server.Host/Components/Byond/PosixByondInstaller.cs +++ b/src/Tgstation.Server.Host/Components/Byond/PosixByondInstaller.cs @@ -70,8 +70,7 @@ namespace Tgstation.Server.Host.Components.Byond /// public override string GetDreamDaemonName(Version version, out bool supportsCli) { - if (version == null) - throw new ArgumentNullException(nameof(version)); + ArgumentNullException.ThrowIfNull(version); supportsCli = true; return DreamDaemonExecutableName + ShellScriptExtension; @@ -80,10 +79,8 @@ namespace Tgstation.Server.Host.Components.Byond /// public override Task InstallByond(Version version, string path, CancellationToken cancellationToken) { - if (version == null) - throw new ArgumentNullException(nameof(version)); - if (path == null) - throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(version); + ArgumentNullException.ThrowIfNull(path); // write the scripts for running the ting // need to add $ORIGIN to LD_LIBRARY_PATH @@ -118,10 +115,8 @@ namespace Tgstation.Server.Host.Components.Byond /// public override Task UpgradeInstallation(Version version, string path, CancellationToken cancellationToken) { - if (version == null) - throw new ArgumentNullException(nameof(version)); - if (path == null) - throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(version); + ArgumentNullException.ThrowIfNull(path); return Task.CompletedTask; } diff --git a/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs b/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs index 54110072ca..3bd1e64db1 100644 --- a/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs +++ b/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs @@ -106,8 +106,7 @@ namespace Tgstation.Server.Host.Components.Byond /// public override string GetDreamDaemonName(Version version, out bool supportsCli) { - if (version == null) - throw new ArgumentNullException(nameof(version)); + ArgumentNullException.ThrowIfNull(version); supportsCli = version.Major >= 515 && version.Minor >= 1598; return supportsCli ? "dd.exe" : "dreamdaemon.exe"; @@ -131,10 +130,8 @@ namespace Tgstation.Server.Host.Components.Byond /// public override async Task UpgradeInstallation(Version version, string path, CancellationToken cancellationToken) { - if (version == null) - throw new ArgumentNullException(nameof(version)); - if (path == null) - throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(version); + ArgumentNullException.ThrowIfNull(path); if (generalConfiguration.SkipAddingByondFirewallException) return; diff --git a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs index 94893118db..95246f2e48 100644 --- a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs +++ b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs @@ -143,8 +143,7 @@ namespace Tgstation.Server.Host.Components.Chat { this.providerFactory = providerFactory ?? throw new ArgumentNullException(nameof(providerFactory)); this.commandFactory = commandFactory ?? throw new ArgumentNullException(nameof(commandFactory)); - if (serverControl == null) - throw new ArgumentNullException(nameof(serverControl)); + ArgumentNullException.ThrowIfNull(serverControl); this.loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); activeChatBots = initialChatBots?.ToList() ?? throw new ArgumentNullException(nameof(initialChatBots)); @@ -179,8 +178,7 @@ namespace Tgstation.Server.Host.Components.Chat /// public async Task ChangeChannels(long connectionId, IEnumerable newChannels, CancellationToken cancellationToken) { - if (newChannels == null) - throw new ArgumentNullException(nameof(newChannels)); + ArgumentNullException.ThrowIfNull(newChannels); logger.LogTrace("ChangeChannels {connectionId}...", connectionId); var provider = await RemoveProviderChannels(connectionId, false, cancellationToken); @@ -263,8 +261,7 @@ namespace Tgstation.Server.Host.Components.Chat /// public async Task ChangeSettings(Models.ChatBot newSettings, CancellationToken cancellationToken) { - if (newSettings == null) - throw new ArgumentNullException(nameof(newSettings)); + ArgumentNullException.ThrowIfNull(newSettings); logger.LogTrace("ChangeSettings..."); @@ -326,10 +323,8 @@ namespace Tgstation.Server.Host.Components.Chat /// public void QueueMessage(MessageContent message, IEnumerable channelIds) { - if (message == null) - throw new ArgumentNullException(nameof(message)); - if (channelIds == null) - throw new ArgumentNullException(nameof(channelIds)); + ArgumentNullException.ThrowIfNull(message); + ArgumentNullException.ThrowIfNull(channelIds); QueueMessageInternal(message, () => channelIds, false); } @@ -337,8 +332,7 @@ namespace Tgstation.Server.Host.Components.Chat /// public void QueueWatchdogMessage(string message) { - if (message == null) - throw new ArgumentNullException(nameof(message)); + ArgumentNullException.ThrowIfNull(message); message = String.Format(CultureInfo.InvariantCulture, "WD: {0}", message); diff --git a/src/Tgstation.Server.Host/Components/Chat/ChatTrackingContext.cs b/src/Tgstation.Server.Host/Components/Chat/ChatTrackingContext.cs index 119fb5573f..c390147b62 100644 --- a/src/Tgstation.Server.Host/Components/Chat/ChatTrackingContext.cs +++ b/src/Tgstation.Server.Host/Components/Chat/ChatTrackingContext.cs @@ -121,8 +121,7 @@ namespace Tgstation.Server.Host.Components.Chat /// public void SetChannelSink(IChannelSink channelSink) { - if (channelSink == null) - throw new ArgumentNullException(nameof(channelSink)); + ArgumentNullException.ThrowIfNull(channelSink); lock (synchronizationLock) { diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs index 1fbdf6ed53..805ac1dc6a 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs @@ -291,8 +291,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers /// public override async Task SendMessage(Message replyTo, MessageContent message, ulong channelId, CancellationToken cancellationToken) { - if (message == null) - throw new ArgumentNullException(nameof(message)); + ArgumentNullException.ThrowIfNull(message); Optional replyToReference = default; Optional allowedMentions = default; @@ -391,14 +390,10 @@ namespace Tgstation.Server.Host.Components.Chat.Providers bool localCommitPushed, CancellationToken cancellationToken) { - if (revisionInformation == null) - throw new ArgumentNullException(nameof(revisionInformation)); - if (byondVersion == null) - throw new ArgumentNullException(nameof(byondVersion)); - if (gitHubOwner == null) - throw new ArgumentNullException(nameof(gitHubOwner)); - if (gitHubRepo == null) - throw new ArgumentNullException(nameof(gitHubRepo)); + ArgumentNullException.ThrowIfNull(revisionInformation); + ArgumentNullException.ThrowIfNull(byondVersion); + ArgumentNullException.ThrowIfNull(gitHubOwner); + ArgumentNullException.ThrowIfNull(gitHubRepo); localCommitPushed |= revisionInformation.CommitSha == revisionInformation.OriginCommitSha; @@ -518,8 +513,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers /// public async Task RespondAsync(IMessageCreate messageCreateEvent, CancellationToken cancellationToken) { - if (messageCreateEvent == null) - throw new ArgumentNullException(nameof(messageCreateEvent)); + ArgumentNullException.ThrowIfNull(messageCreateEvent); if ((messageCreateEvent.Type != MessageType.Default && messageCreateEvent.Type != MessageType.InlineReply) @@ -631,8 +625,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers /// public Task RespondAsync(IReady readyEvent, CancellationToken cancellationToken) { - if (readyEvent == null) - throw new ArgumentNullException(nameof(readyEvent)); + ArgumentNullException.ThrowIfNull(readyEvent); Logger.LogTrace("Gatway ready. Version: {version}", readyEvent.Version); gatewayReadyTcs?.TrySetResult(); @@ -727,8 +720,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers /// protected override async Task>> MapChannelsImpl(IEnumerable channels, CancellationToken cancellationToken) { - if (channels == null) - throw new ArgumentNullException(nameof(channels)); + ArgumentNullException.ThrowIfNull(channels); var remapRequired = false; var guildsClient = serviceProvider.GetRequiredService(); diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/IrcProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/IrcProvider.cs index e8db69db69..91b43c6fb5 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/IrcProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/IrcProvider.cs @@ -113,8 +113,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers Models.ChatBot chatBot) : base(jobManager, asyncDelayer, logger, chatBot) { - if (assemblyInformationProvider == null) - throw new ArgumentNullException(nameof(assemblyInformationProvider)); + ArgumentNullException.ThrowIfNull(assemblyInformationProvider); var builder = chatBot.CreateConnectionStringBuilder(); if (builder == null || !builder.Valid || builder is not IrcConnectionStringBuilder ircBuilder) @@ -167,8 +166,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers /// public override Task SendMessage(Message replyTo, MessageContent message, ulong channelId, CancellationToken cancellationToken) { - if (message == null) - throw new ArgumentNullException(nameof(message)); + ArgumentNullException.ThrowIfNull(message); return Task.Factory.StartNew( () => @@ -230,14 +228,10 @@ namespace Tgstation.Server.Host.Components.Chat.Providers bool localCommitPushed, CancellationToken cancellationToken) { - if (revisionInformation == null) - throw new ArgumentNullException(nameof(revisionInformation)); - if (byondVersion == null) - throw new ArgumentNullException(nameof(byondVersion)); - if (gitHubOwner == null) - throw new ArgumentNullException(nameof(gitHubOwner)); - if (gitHubRepo == null) - throw new ArgumentNullException(nameof(gitHubRepo)); + ArgumentNullException.ThrowIfNull(revisionInformation); + ArgumentNullException.ThrowIfNull(byondVersion); + ArgumentNullException.ThrowIfNull(gitHubOwner); + ArgumentNullException.ThrowIfNull(gitHubRepo); var commitInsert = revisionInformation.CommitSha[..7]; string remoteCommitInsert; diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/ProviderFactory.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/ProviderFactory.cs index 775db6c2e5..eeed8c1583 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/ProviderFactory.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/ProviderFactory.cs @@ -55,8 +55,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers /// public IProvider CreateProvider(Models.ChatBot settings) { - if (settings == null) - throw new ArgumentNullException(nameof(settings)); + ArgumentNullException.ThrowIfNull(settings); return settings.Provider switch { ChatProvider.Irc => new IrcProvider( diff --git a/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs b/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs index 2c5abb0541..76f8c3af5b 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs @@ -130,8 +130,7 @@ namespace Tgstation.Server.Host.Components.Deployment /// public async Task LoadCompileJob(CompileJob job, CancellationToken cancellationToken) { - if (job == null) - throw new ArgumentNullException(nameof(job)); + ArgumentNullException.ThrowIfNull(job); var newProvider = await FromCompileJob(job, cancellationToken); if (newProvider == null) @@ -216,8 +215,7 @@ namespace Tgstation.Server.Host.Components.Deployment #pragma warning disable CA1506 // TODO: Decomplexify public async Task FromCompileJob(CompileJob compileJob, CancellationToken cancellationToken) { - if (compileJob == null) - throw new ArgumentNullException(nameof(compileJob)); + ArgumentNullException.ThrowIfNull(compileJob); // ensure we have the entire metadata tree logger.LogTrace("Loading compile job {0}...", compileJob.Id); diff --git a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs index 31e8e3a956..3fc0003c50 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs @@ -199,12 +199,9 @@ namespace Tgstation.Server.Host.Components.Deployment JobProgressReporter progressReporter, CancellationToken cancellationToken) { - if (job == null) - throw new ArgumentNullException(nameof(job)); - if (databaseContextFactory == null) - throw new ArgumentNullException(nameof(databaseContextFactory)); - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(job); + ArgumentNullException.ThrowIfNull(databaseContextFactory); + ArgumentNullException.ThrowIfNull(progressReporter); lock (deploymentLock) { diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs index d0cf3471ad..16630a9f08 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs @@ -57,10 +57,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote CompileJob compileJob, CancellationToken cancellationToken) { - if (remoteInformation == null) - throw new ArgumentNullException(nameof(remoteInformation)); - if (compileJob == null) - throw new ArgumentNullException(nameof(compileJob)); + ArgumentNullException.ThrowIfNull(remoteInformation); + ArgumentNullException.ThrowIfNull(compileJob); Logger.LogTrace("Starting deployment..."); @@ -187,12 +185,9 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote RevisionInformation revisionInformation, CancellationToken cancellationToken) { - if (repository == null) - throw new ArgumentNullException(nameof(repository)); - if (repositorySettings == null) - throw new ArgumentNullException(nameof(repositorySettings)); - if (revisionInformation == null) - throw new ArgumentNullException(nameof(revisionInformation)); + ArgumentNullException.ThrowIfNull(repository); + ArgumentNullException.ThrowIfNull(repositorySettings); + ArgumentNullException.ThrowIfNull(revisionInformation); if (revisionInformation.ActiveTestMerges?.Any() != true) { @@ -311,8 +306,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote DeploymentState deploymentState, CancellationToken cancellationToken) { - if (compileJob == null) - throw new ArgumentNullException(nameof(compileJob)); + ArgumentNullException.ThrowIfNull(compileJob); if (!compileJob.GitHubRepoId.HasValue || !compileJob.GitHubDeploymentId.HasValue) { diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs index 62c6e31ccd..afce81718d 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs @@ -38,12 +38,9 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote RevisionInformation revisionInformation, CancellationToken cancellationToken) { - if (repository == null) - throw new ArgumentNullException(nameof(repository)); - if (repositorySettings == null) - throw new ArgumentNullException(nameof(repositorySettings)); - if (revisionInformation == null) - throw new ArgumentNullException(nameof(revisionInformation)); + ArgumentNullException.ThrowIfNull(repository); + ArgumentNullException.ThrowIfNull(repositorySettings); + ArgumentNullException.ThrowIfNull(revisionInformation); if (revisionInformation.ActiveTestMerges?.Any() != true) { diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/RemoteDeploymentManagerFactory.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/RemoteDeploymentManagerFactory.cs index 4ba8882137..e05f885241 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/Remote/RemoteDeploymentManagerFactory.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/RemoteDeploymentManagerFactory.cs @@ -62,8 +62,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote /// public IRemoteDeploymentManager CreateRemoteDeploymentManager(Api.Models.Instance metadata, RemoteGitProvider remoteGitProvider) { - if (metadata == null) - throw new ArgumentNullException(nameof(metadata)); + ArgumentNullException.ThrowIfNull(metadata); logger.LogTrace("Creating remote deployment manager for remote git provider {remoteGitProvider}...", remoteGitProvider); return remoteGitProvider switch @@ -84,8 +83,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote /// public IRemoteDeploymentManager CreateRemoteDeploymentManager(Api.Models.Instance metadata, Models.CompileJob compileJob) { - if (compileJob == null) - throw new ArgumentNullException(nameof(compileJob)); + ArgumentNullException.ThrowIfNull(compileJob); RemoteGitProvider remoteGitProvider; diff --git a/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs b/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs index a2855e0d8f..3613f48da8 100644 --- a/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs +++ b/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs @@ -33,8 +33,7 @@ namespace Tgstation.Server.Host.Components.Events /// public async Task HandleEvent(EventType eventType, IEnumerable parameters, CancellationToken cancellationToken) { - if (parameters == null) - throw new ArgumentNullException(nameof(parameters)); + ArgumentNullException.ThrowIfNull(parameters); if (watchdog == null) throw new InvalidOperationException("EventConsumer used without watchdog set!"); @@ -51,8 +50,7 @@ namespace Tgstation.Server.Host.Components.Events public void SetWatchdog(IWatchdog watchdog) { #pragma warning disable IDE0016 // Use 'throw' expression - if (watchdog == null) - throw new ArgumentNullException(nameof(watchdog)); + ArgumentNullException.ThrowIfNull(watchdog); #pragma warning restore IDE0016 // Use 'throw' expression if (this.watchdog != null) throw new InvalidOperationException("watchdog already set!"); diff --git a/src/Tgstation.Server.Host/Components/InstanceFactory.cs b/src/Tgstation.Server.Host/Components/InstanceFactory.cs index 5c7c24929f..df1f4217e4 100644 --- a/src/Tgstation.Server.Host/Components/InstanceFactory.cs +++ b/src/Tgstation.Server.Host/Components/InstanceFactory.cs @@ -249,8 +249,7 @@ namespace Tgstation.Server.Host.Components /// public IIOManager CreateGameIOManager(Models.Instance metadata) { - if (metadata == null) - throw new ArgumentNullException(nameof(metadata)); + ArgumentNullException.ThrowIfNull(metadata); var instanceIoManager = CreateInstanceIOManager(metadata); return CreateGameIOManager(instanceIoManager); @@ -260,10 +259,8 @@ namespace Tgstation.Server.Host.Components #pragma warning disable CA1506 // TODO: Decomplexify public async Task CreateInstance(IBridgeRegistrar bridgeRegistrar, Models.Instance metadata) { - if (bridgeRegistrar == null) - throw new ArgumentNullException(nameof(bridgeRegistrar)); - if (metadata == null) - throw new ArgumentNullException(nameof(metadata)); + ArgumentNullException.ThrowIfNull(bridgeRegistrar); + ArgumentNullException.ThrowIfNull(metadata); // Create the ioManager for the instance var instanceIoManager = CreateInstanceIOManager(metadata); diff --git a/src/Tgstation.Server.Host/Components/InstanceManager.cs b/src/Tgstation.Server.Host/Components/InstanceManager.cs index 1ffb944912..9e58365dfd 100644 --- a/src/Tgstation.Server.Host/Components/InstanceManager.cs +++ b/src/Tgstation.Server.Host/Components/InstanceManager.cs @@ -218,8 +218,7 @@ namespace Tgstation.Server.Host.Components /// public IInstanceReference GetInstanceReference(Api.Models.Instance metadata) { - if (metadata == null) - throw new ArgumentNullException(nameof(metadata)); + ArgumentNullException.ThrowIfNull(metadata); lock (instances) { @@ -233,8 +232,7 @@ namespace Tgstation.Server.Host.Components /// public async Task MoveInstance(Models.Instance instance, string oldPath, CancellationToken cancellationToken) { - if (oldPath == null) - throw new ArgumentNullException(nameof(oldPath)); + ArgumentNullException.ThrowIfNull(oldPath); using var lockContext = await SemaphoreSlimContext.Lock(instanceStateChangeSemaphore, cancellationToken); using var instanceReferenceCheck = GetInstanceReference(instance); @@ -305,8 +303,7 @@ namespace Tgstation.Server.Host.Components /// public async Task OfflineInstance(Models.Instance metadata, Models.User user, CancellationToken cancellationToken) { - if (metadata == null) - throw new ArgumentNullException(nameof(metadata)); + ArgumentNullException.ThrowIfNull(metadata); using (await SemaphoreSlimContext.Lock(instanceStateChangeSemaphore, cancellationToken)) { @@ -372,8 +369,7 @@ namespace Tgstation.Server.Host.Components /// public async Task OnlineInstance(Models.Instance metadata, CancellationToken cancellationToken) { - if (metadata == null) - throw new ArgumentNullException(nameof(metadata)); + ArgumentNullException.ThrowIfNull(metadata); using var lockContext = await SemaphoreSlimContext.Lock(instanceStateChangeSemaphore, cancellationToken); lock (instances) @@ -471,8 +467,7 @@ namespace Tgstation.Server.Host.Components /// public async Task ProcessBridgeRequest(BridgeParameters parameters, CancellationToken cancellationToken) { - if (parameters == null) - throw new ArgumentNullException(nameof(parameters)); + ArgumentNullException.ThrowIfNull(parameters); IBridgeHandler bridgeHandler = null; for (var i = 0; bridgeHandler == null && i < 30; ++i) @@ -501,8 +496,7 @@ namespace Tgstation.Server.Host.Components /// public IBridgeRegistration RegisterHandler(IBridgeHandler bridgeHandler) { - if (bridgeHandler == null) - throw new ArgumentNullException(nameof(bridgeHandler)); + ArgumentNullException.ThrowIfNull(bridgeHandler); var accessIdentifier = bridgeHandler.DMApiParameters.AccessIdentifier; lock (bridgeHandlers) diff --git a/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs b/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs index 21fb186b92..5d0d13b7fa 100644 --- a/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs +++ b/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs @@ -76,8 +76,7 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge bool apiValidateOnly) : base(chatTrackingContext?.Channels ?? throw new ArgumentNullException(nameof(chatTrackingContext))) { - if (dmbProvider == null) - throw new ArgumentNullException(nameof(dmbProvider)); + ArgumentNullException.ThrowIfNull(dmbProvider); ServerVersion = serverVersion ?? throw new ArgumentNullException(nameof(serverVersion)); diff --git a/src/Tgstation.Server.Host/Components/Repository/GitHubRemoteFeatures.cs b/src/Tgstation.Server.Host/Components/Repository/GitHubRemoteFeatures.cs index 165047dcae..ecbda4c74c 100644 --- a/src/Tgstation.Server.Host/Components/Repository/GitHubRemoteFeatures.cs +++ b/src/Tgstation.Server.Host/Components/Repository/GitHubRemoteFeatures.cs @@ -47,8 +47,7 @@ namespace Tgstation.Server.Host.Components.Repository { this.gitHubServiceFactory = gitHubServiceFactory ?? throw new ArgumentNullException(nameof(gitHubServiceFactory)); - if (remoteUrl == null) - throw new ArgumentNullException(nameof(remoteUrl)); + ArgumentNullException.ThrowIfNull(remoteUrl); RemoteRepositoryOwner = remoteUrl.Segments[1].TrimEnd('/'); RemoteRepositoryName = remoteUrl.Segments[2].TrimEnd('/'); diff --git a/src/Tgstation.Server.Host/Components/Repository/GitRemoteFeaturesBase.cs b/src/Tgstation.Server.Host/Components/Repository/GitRemoteFeaturesBase.cs index 7fcfdbf2b0..a1ec955e4d 100644 --- a/src/Tgstation.Server.Host/Components/Repository/GitRemoteFeaturesBase.cs +++ b/src/Tgstation.Server.Host/Components/Repository/GitRemoteFeaturesBase.cs @@ -48,8 +48,7 @@ namespace Tgstation.Server.Host.Components.Repository public GitRemoteFeaturesBase(ILogger logger, Uri remoteUrl) { Logger = logger ?? throw new ArgumentNullException(nameof(logger)); - if (remoteUrl == null) - throw new ArgumentNullException(nameof(remoteUrl)); + ArgumentNullException.ThrowIfNull(remoteUrl); cachedLookups = new Dictionary(); } @@ -60,10 +59,8 @@ namespace Tgstation.Server.Host.Components.Repository RepositorySettings repositorySettings, CancellationToken cancellationToken) { - if (parameters == null) - throw new ArgumentNullException(nameof(parameters)); - if (repositorySettings == null) - throw new ArgumentNullException(nameof(repositorySettings)); + ArgumentNullException.ThrowIfNull(parameters); + ArgumentNullException.ThrowIfNull(repositorySettings); Models.TestMerge result; lock (cachedLookups) diff --git a/src/Tgstation.Server.Host/Components/Repository/GitRemoteFeaturesFactory.cs b/src/Tgstation.Server.Host/Components/Repository/GitRemoteFeaturesFactory.cs index e19b4c22f0..ab5dcb45ec 100644 --- a/src/Tgstation.Server.Host/Components/Repository/GitRemoteFeaturesFactory.cs +++ b/src/Tgstation.Server.Host/Components/Repository/GitRemoteFeaturesFactory.cs @@ -44,8 +44,7 @@ namespace Tgstation.Server.Host.Components.Repository /// public IGitRemoteFeatures CreateGitRemoteFeatures(IRepository repository) { - if (repository == null) - throw new ArgumentNullException(nameof(repository)); + ArgumentNullException.ThrowIfNull(repository); var primaryRemote = repository.Origin; var remoteGitProvider = ParseRemoteGitProviderFromOrigin(primaryRemote); @@ -66,8 +65,7 @@ namespace Tgstation.Server.Host.Components.Repository /// public RemoteGitProvider ParseRemoteGitProviderFromOrigin(Uri origin) { - if (origin == null) - throw new ArgumentNullException(nameof(origin)); + ArgumentNullException.ThrowIfNull(origin); switch (origin.Host.ToUpperInvariant()) { diff --git a/src/Tgstation.Server.Host/Components/Repository/LibGit2Commands.cs b/src/Tgstation.Server.Host/Components/Repository/LibGit2Commands.cs index 4d557149bd..ec5c37a880 100644 --- a/src/Tgstation.Server.Host/Components/Repository/LibGit2Commands.cs +++ b/src/Tgstation.Server.Host/Components/Repository/LibGit2Commands.cs @@ -20,11 +20,9 @@ namespace Tgstation.Server.Host.Components.Repository FetchOptions fetchOptions, string logMessage) { - if (libGit2Repo == null) - throw new ArgumentNullException(nameof(libGit2Repo)); + ArgumentNullException.ThrowIfNull(libGit2Repo); - if (remote == null) - throw new ArgumentNullException(nameof(remote)); + ArgumentNullException.ThrowIfNull(remote); Commands.Fetch((LibGit2Sharp.Repository)libGit2Repo, remote.Name, refSpecs, fetchOptions, logMessage); } diff --git a/src/Tgstation.Server.Host/Components/Repository/LibGit2RepositoryFactory.cs b/src/Tgstation.Server.Host/Components/Repository/LibGit2RepositoryFactory.cs index 65af4f9721..2bbc60cccd 100644 --- a/src/Tgstation.Server.Host/Components/Repository/LibGit2RepositoryFactory.cs +++ b/src/Tgstation.Server.Host/Components/Repository/LibGit2RepositoryFactory.cs @@ -40,8 +40,7 @@ namespace Tgstation.Server.Host.Components.Repository /// public async Task CreateFromPath(string path, CancellationToken cancellationToken) { - if (path == null) - throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(path); var repo = await Task.Factory.StartNew( () => @@ -111,8 +110,7 @@ namespace Tgstation.Server.Host.Components.Repository /// public void CheckBadCredentialsException(LibGit2SharpException exception) { - if (exception == null) - throw new ArgumentNullException(nameof(exception)); + ArgumentNullException.ThrowIfNull(exception); if (exception.Message == "too many redirects or authentication replays") throw new JobException("Bad git credentials exchange!", exception); diff --git a/src/Tgstation.Server.Host/Components/Repository/Repository.cs b/src/Tgstation.Server.Host/Components/Repository/Repository.cs index f0256c05e1..69c9689deb 100644 --- a/src/Tgstation.Server.Host/Components/Repository/Repository.cs +++ b/src/Tgstation.Server.Host/Components/Repository/Repository.cs @@ -154,8 +154,7 @@ namespace Tgstation.Server.Host.Components.Repository this.eventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer)); this.credentialsProvider = credentialsProvider ?? throw new ArgumentNullException(nameof(credentialsProvider)); this.postWriteHandler = postWriteHandler ?? throw new ArgumentNullException(nameof(postWriteHandler)); - if (gitRemoteFeaturesFactory == null) - throw new ArgumentNullException(nameof(gitRemoteFeaturesFactory)); + ArgumentNullException.ThrowIfNull(gitRemoteFeaturesFactory); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.generalConfiguration = generalConfiguration ?? throw new ArgumentNullException(nameof(generalConfiguration)); @@ -192,14 +191,10 @@ namespace Tgstation.Server.Host.Components.Repository JobProgressReporter progressReporter, CancellationToken cancellationToken) { - if (testMergeParameters == null) - throw new ArgumentNullException(nameof(testMergeParameters)); - if (committerName == null) - throw new ArgumentNullException(nameof(committerName)); - if (committerEmail == null) - throw new ArgumentNullException(nameof(committerEmail)); - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(testMergeParameters); + ArgumentNullException.ThrowIfNull(committerName); + ArgumentNullException.ThrowIfNull(committerEmail); + ArgumentNullException.ThrowIfNull(progressReporter); logger.LogDebug( "Begin AddTestMerge: #{prNumber} at {targetSha} ({comment}) by <{committerName} ({committerEmail})>", @@ -394,10 +389,8 @@ namespace Tgstation.Server.Host.Components.Repository JobProgressReporter progressReporter, CancellationToken cancellationToken) { - if (committish == null) - throw new ArgumentNullException(nameof(committish)); - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(committish); + ArgumentNullException.ThrowIfNull(progressReporter); logger.LogDebug("Checkout object: {committish}...", committish); await eventConsumer.HandleEvent(EventType.RepoCheckout, new List { committish }, cancellationToken); await Task.Factory.StartNew( @@ -424,8 +417,7 @@ namespace Tgstation.Server.Host.Components.Repository /// public async Task FetchOrigin(string username, string password, JobProgressReporter progressReporter, CancellationToken cancellationToken) { - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(progressReporter); logger.LogDebug("Fetch origin..."); await eventConsumer.HandleEvent(EventType.RepoFetch, Enumerable.Empty(), cancellationToken); await Task.Factory.StartNew( @@ -472,8 +464,7 @@ namespace Tgstation.Server.Host.Components.Repository JobProgressReporter progressReporter, CancellationToken cancellationToken) { - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(progressReporter); if (!Tracking) throw new JobException(ErrorCode.RepoReferenceRequired); logger.LogTrace("Reset to origin..."); @@ -496,10 +487,8 @@ namespace Tgstation.Server.Host.Components.Repository public Task ResetToSha(string sha, JobProgressReporter progressReporter, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (sha == null) - throw new ArgumentNullException(nameof(sha)); - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(sha); + ArgumentNullException.ThrowIfNull(progressReporter); logger.LogDebug("Reset to sha: {sha}", sha[..7]); @@ -524,8 +513,7 @@ namespace Tgstation.Server.Host.Components.Repository /// public async Task CopyTo(string path, CancellationToken cancellationToken) { - if (path == null) - throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(path); logger.LogTrace("Copying to {path}...", path); await ioMananger.CopyDirectory( new List { ".git" }, @@ -564,8 +552,7 @@ namespace Tgstation.Server.Host.Components.Repository JobProgressReporter progressReporter, CancellationToken cancellationToken) { - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(progressReporter); MergeResult result = null; Branch trackedBranch = null; @@ -636,12 +623,9 @@ namespace Tgstation.Server.Host.Components.Repository bool synchronizeTrackedBranch, CancellationToken cancellationToken) { - if (committerName == null) - throw new ArgumentNullException(nameof(committerName)); - if (committerEmail == null) - throw new ArgumentNullException(nameof(committerEmail)); - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(committerName); + ArgumentNullException.ThrowIfNull(committerEmail); + ArgumentNullException.ThrowIfNull(progressReporter); if (username == null && password == null) { @@ -651,10 +635,8 @@ namespace Tgstation.Server.Host.Components.Repository logger.LogTrace("Begin Synchronize..."); - if (username == null) - throw new ArgumentNullException(nameof(username)); - if (password == null) - throw new ArgumentNullException(nameof(password)); + ArgumentNullException.ThrowIfNull(username); + ArgumentNullException.ThrowIfNull(password); var startHead = Head; @@ -834,8 +816,7 @@ namespace Tgstation.Server.Host.Components.Repository public Task TimestampCommit(string sha, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (sha == null) - throw new ArgumentNullException(nameof(sha)); + ArgumentNullException.ThrowIfNull(sha); var commit = libGitRepo.Lookup(sha) ?? throw new JobException($"Commit {sha} does not exist in the repository!"); return commit.Committer.When.ToUniversalTime(); diff --git a/src/Tgstation.Server.Host/Components/Repository/RepositoryManager.cs b/src/Tgstation.Server.Host/Components/Repository/RepositoryManager.cs index 798bff74f4..6a654a597e 100644 --- a/src/Tgstation.Server.Host/Components/Repository/RepositoryManager.cs +++ b/src/Tgstation.Server.Host/Components/Repository/RepositoryManager.cs @@ -126,10 +126,8 @@ namespace Tgstation.Server.Host.Components.Repository bool recurseSubmodules, CancellationToken cancellationToken) { - if (url == null) - throw new ArgumentNullException(nameof(url)); - if (progressReporter == null) - throw new ArgumentNullException(nameof(progressReporter)); + ArgumentNullException.ThrowIfNull(url); + ArgumentNullException.ThrowIfNull(progressReporter); logger.LogInformation("Begin clone {url} (Branch: {initialBranch})", url, initialBranch); lock (semaphore) diff --git a/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs b/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs index 7a9661d5c7..c575f7a2e1 100644 --- a/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs +++ b/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs @@ -93,8 +93,7 @@ namespace Tgstation.Server.Host.Components.Session /// The . public void SetRuntimeInformation(RuntimeInformation runtimeInformation) { - if (runtimeInformation == null) - throw new ArgumentNullException(nameof(runtimeInformation)); + ArgumentNullException.ThrowIfNull(runtimeInformation); lock (runtimeInformationLock) { diff --git a/src/Tgstation.Server.Host/Components/Session/SessionController.cs b/src/Tgstation.Server.Host/Components/Session/SessionController.cs index b7978ff051..9242b02c0c 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionController.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionController.cs @@ -220,12 +220,10 @@ namespace Tgstation.Server.Host.Components.Session this.byondLock = byondLock ?? throw new ArgumentNullException(nameof(byondLock)); this.byondTopicSender = byondTopicSender ?? throw new ArgumentNullException(nameof(byondTopicSender)); this.chatTrackingContext = chatTrackingContext ?? throw new ArgumentNullException(nameof(chatTrackingContext)); - if (bridgeRegistrar == null) - throw new ArgumentNullException(nameof(bridgeRegistrar)); + ArgumentNullException.ThrowIfNull(bridgeRegistrar); this.chat = chat ?? throw new ArgumentNullException(nameof(chat)); - if (assemblyInformationProvider == null) - throw new ArgumentNullException(nameof(assemblyInformationProvider)); + ArgumentNullException.ThrowIfNull(assemblyInformationProvider); this.asyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer)); @@ -310,8 +308,7 @@ namespace Tgstation.Server.Host.Components.Session /// public async Task ProcessBridgeRequest(BridgeParameters parameters, CancellationToken cancellationToken) { - if (parameters == null) - throw new ArgumentNullException(nameof(parameters)); + ArgumentNullException.ThrowIfNull(parameters); using (LogContext.PushProperty(SerilogContextHelper.InstanceIdContextProperty, metadata.Id)) { @@ -346,8 +343,7 @@ namespace Tgstation.Server.Host.Components.Session /// public async Task SendCommand(TopicParameters parameters, CancellationToken cancellationToken) { - if (parameters == null) - throw new ArgumentNullException(nameof(parameters)); + ArgumentNullException.ThrowIfNull(parameters); if (Lifetime.IsCompleted) { diff --git a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs index 586af39cd4..de3acc2431 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs @@ -390,8 +390,7 @@ namespace Tgstation.Server.Host.Components.Session ReattachInformation reattachInformation, CancellationToken cancellationToken) { - if (reattachInformation == null) - throw new ArgumentNullException(nameof(reattachInformation)); + ArgumentNullException.ThrowIfNull(reattachInformation); logger.LogTrace("Begin session reattach..."); var byondTopicSender = topicClientFactory.CreateTopicClient(reattachInformation.TopicRequestTimeout); diff --git a/src/Tgstation.Server.Host/Components/Session/SessionPersistor.cs b/src/Tgstation.Server.Host/Components/Session/SessionPersistor.cs index 6b1020fd92..cd16cfd376 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionPersistor.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionPersistor.cs @@ -67,8 +67,7 @@ namespace Tgstation.Server.Host.Components.Session /// public Task Save(ReattachInformation reattachInformation, CancellationToken cancellationToken) => databaseContextFactory.UseContext(async (db) => { - if (reattachInformation == null) - throw new ArgumentNullException(nameof(reattachInformation)); + ArgumentNullException.ThrowIfNull(reattachInformation); logger.LogDebug("Saving reattach information: {info}...", reattachInformation); diff --git a/src/Tgstation.Server.Host/Components/Session/TopicClientFactory.cs b/src/Tgstation.Server.Host/Components/Session/TopicClientFactory.cs index df0289a380..40605e5de8 100644 --- a/src/Tgstation.Server.Host/Components/Session/TopicClientFactory.cs +++ b/src/Tgstation.Server.Host/Components/Session/TopicClientFactory.cs @@ -19,8 +19,7 @@ namespace Tgstation.Server.Host.Components.Session /// The value of . public TopicClientFactory(ILogger logger) { - if (logger == null) - throw new ArgumentNullException(nameof(logger)); + ArgumentNullException.ThrowIfNull(logger); // Don't want the debug logs Topic client spits out either, they're too verbose if (logger.IsEnabled(LogLevel.Trace)) diff --git a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs index c55ad004ea..6e80a0c475 100644 --- a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs +++ b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs @@ -550,8 +550,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles /// public async Task HandleEvent(EventType eventType, IEnumerable parameters, CancellationToken cancellationToken) { - if (parameters == null) - throw new ArgumentNullException(nameof(parameters)); + ArgumentNullException.ThrowIfNull(parameters); await EnsureDirectories(cancellationToken); diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs index 4a748ee869..8eb3cb66ae 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs @@ -214,8 +214,7 @@ namespace Tgstation.Server.Host.Components.Watchdog this.metadata = metadata ?? throw new ArgumentNullException(nameof(metadata)); this.autoStart = autoStart; - if (serverControl == null) - throw new ArgumentNullException(nameof(serverControl)); + ArgumentNullException.ThrowIfNull(serverControl); chat.RegisterCommandHandler(this); @@ -452,8 +451,7 @@ namespace Tgstation.Server.Host.Components.Watchdog /// async Task IEventConsumer.HandleEvent(EventType eventType, IEnumerable parameters, CancellationToken cancellationToken) { - if (parameters == null) - throw new ArgumentNullException(nameof(parameters)); + ArgumentNullException.ThrowIfNull(parameters); // Method explicitly implemented to prevent accidental calls when this.eventConsumer should be used. var activeServer = GetActiveController(); diff --git a/src/Tgstation.Server.Host/Configuration/FileLoggingConfiguration.cs b/src/Tgstation.Server.Host/Configuration/FileLoggingConfiguration.cs index 7dbcb2e872..a4cefdfde1 100644 --- a/src/Tgstation.Server.Host/Configuration/FileLoggingConfiguration.cs +++ b/src/Tgstation.Server.Host/Configuration/FileLoggingConfiguration.cs @@ -63,12 +63,9 @@ namespace Tgstation.Server.Host.Configuration IAssemblyInformationProvider assemblyInformationProvider, IPlatformIdentifier platformIdentifier) { - if (ioManager == null) - throw new ArgumentNullException(nameof(ioManager)); - if (assemblyInformationProvider == null) - throw new ArgumentNullException(nameof(assemblyInformationProvider)); - if (platformIdentifier == null) - throw new ArgumentNullException(nameof(platformIdentifier)); + ArgumentNullException.ThrowIfNull(ioManager); + ArgumentNullException.ThrowIfNull(assemblyInformationProvider); + ArgumentNullException.ThrowIfNull(platformIdentifier); var directoryToUse = platformIdentifier.IsWindows ? Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) // C:/ProgramData diff --git a/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs b/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs index 4b17fffa15..22233ce36b 100644 --- a/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs +++ b/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs @@ -139,8 +139,7 @@ namespace Tgstation.Server.Host.Configuration /// The to use. public void CheckCompatibility(ILogger logger) { - if (logger == null) - throw new ArgumentNullException(nameof(logger)); + ArgumentNullException.ThrowIfNull(logger); if (ConfigVersion == null) logger.LogCritical( diff --git a/src/Tgstation.Server.Host/Configuration/OAuthConfigurationBase.cs b/src/Tgstation.Server.Host/Configuration/OAuthConfigurationBase.cs index a32db951d8..d2d7668072 100644 --- a/src/Tgstation.Server.Host/Configuration/OAuthConfigurationBase.cs +++ b/src/Tgstation.Server.Host/Configuration/OAuthConfigurationBase.cs @@ -30,8 +30,7 @@ namespace Tgstation.Server.Host.Configuration /// The to copy settings from. public OAuthConfigurationBase(OAuthConfigurationBase oAuthConfiguration) { - if (oAuthConfiguration == null) - throw new ArgumentNullException(nameof(oAuthConfiguration)); + ArgumentNullException.ThrowIfNull(oAuthConfiguration); ClientId = oAuthConfiguration.ClientId; ClientSecret = oAuthConfiguration.ClientSecret; } diff --git a/src/Tgstation.Server.Host/Controllers/AdministrationController.cs b/src/Tgstation.Server.Host/Controllers/AdministrationController.cs index 8eef0e4648..104f1736b9 100644 --- a/src/Tgstation.Server.Host/Controllers/AdministrationController.cs +++ b/src/Tgstation.Server.Host/Controllers/AdministrationController.cs @@ -202,8 +202,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(ErrorMessageResponse), 429)] public async Task Update([FromBody] ServerUpdateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); var attemptingUpload = model.UploadZip == true; if (attemptingUpload) @@ -326,8 +325,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(ErrorMessageResponse), 409)] public async Task GetLog(string path, CancellationToken cancellationToken) { - if (path == null) - throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(path); path = HttpUtility.UrlDecode(path); diff --git a/src/Tgstation.Server.Host/Controllers/ApiController.cs b/src/Tgstation.Server.Host/Controllers/ApiController.cs index 2e0841d409..f9e3868ada 100644 --- a/src/Tgstation.Server.Host/Controllers/ApiController.cs +++ b/src/Tgstation.Server.Host/Controllers/ApiController.cs @@ -91,8 +91,7 @@ namespace Tgstation.Server.Host.Controllers bool requireHeaders) { DatabaseContext = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext)); - if (authenticationContextFactory == null) - throw new ArgumentNullException(nameof(authenticationContextFactory)); + ArgumentNullException.ThrowIfNull(authenticationContextFactory); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); AuthenticationContext = authenticationContextFactory.CurrentAuthenticationContext; Instance = AuthenticationContext?.InstancePermissionSet?.Instance; @@ -103,8 +102,7 @@ namespace Tgstation.Server.Host.Controllers #pragma warning disable CA1506 // TODO: Decomplexify public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { - if (context == null) - throw new ArgumentNullException(nameof(context)); + ArgumentNullException.ThrowIfNull(context); // ALL valid token and login requests that match a route go through this function // 404 is returned before @@ -245,8 +243,7 @@ namespace Tgstation.Server.Host.Controllers /// A . protected ObjectResult RateLimit(RateLimitExceededException rateLimitException) { - if (rateLimitException == null) - throw new ArgumentNullException(nameof(rateLimitException)); + ArgumentNullException.ThrowIfNull(rateLimitException); Logger.LogWarning(rateLimitException, "Exceeded GitHub rate limit!"); @@ -357,8 +354,7 @@ namespace Tgstation.Server.Host.Controllers int? pageSizeQuery, CancellationToken cancellationToken) { - if (queryGenerator == null) - throw new ArgumentNullException(nameof(queryGenerator)); + ArgumentNullException.ThrowIfNull(queryGenerator); if (pageQuery <= 0 || pageSizeQuery <= 0) return BadRequest(new ErrorMessageResponse(ErrorCode.ApiInvalidPageOrPageSize)); diff --git a/src/Tgstation.Server.Host/Controllers/BridgeController.cs b/src/Tgstation.Server.Host/Controllers/BridgeController.cs index 32bbee7fee..88d445cebc 100644 --- a/src/Tgstation.Server.Host/Controllers/BridgeController.cs +++ b/src/Tgstation.Server.Host/Controllers/BridgeController.cs @@ -62,8 +62,7 @@ namespace Tgstation.Server.Host.Controllers public BridgeController(IBridgeDispatcher bridgeDispatcher, IHostApplicationLifetime applicationLifetime, ILogger logger) { this.bridgeDispatcher = bridgeDispatcher ?? throw new ArgumentNullException(nameof(bridgeDispatcher)); - if (applicationLifetime == null) - throw new ArgumentNullException(nameof(applicationLifetime)); + ArgumentNullException.ThrowIfNull(applicationLifetime); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); diff --git a/src/Tgstation.Server.Host/Controllers/ByondController.cs b/src/Tgstation.Server.Host/Controllers/ByondController.cs index d3de553456..92c9878d7b 100644 --- a/src/Tgstation.Server.Host/Controllers/ByondController.cs +++ b/src/Tgstation.Server.Host/Controllers/ByondController.cs @@ -133,8 +133,7 @@ namespace Tgstation.Server.Host.Controllers public async Task Update([FromBody] ByondVersionRequest model, CancellationToken cancellationToken) #pragma warning restore CA1506 { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); var uploadingZip = model.UploadCustomZip == true; @@ -269,8 +268,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(ErrorMessageResponse), 410)] public async Task Delete([FromBody] ByondVersionDeleteRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (model.Version == null || model.Version.Revision != -1) diff --git a/src/Tgstation.Server.Host/Controllers/ChatController.cs b/src/Tgstation.Server.Host/Controllers/ChatController.cs index 0b9931f05a..8b8004cb69 100644 --- a/src/Tgstation.Server.Host/Controllers/ChatController.cs +++ b/src/Tgstation.Server.Host/Controllers/ChatController.cs @@ -106,8 +106,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(ChatBotResponse), 201)] public async Task Create([FromBody] ChatBotCreateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); var earlyOut = StandardModelChecks(model, true); if (earlyOut != null) @@ -279,8 +278,7 @@ namespace Tgstation.Server.Host.Controllers public async Task Update([FromBody] ChatBotUpdateRequest model, CancellationToken cancellationToken) #pragma warning restore CA1502, CA1506 { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); var earlyOut = StandardModelChecks(model, false); if (earlyOut != null) diff --git a/src/Tgstation.Server.Host/Controllers/ComponentInterfacingController.cs b/src/Tgstation.Server.Host/Controllers/ComponentInterfacingController.cs index 46874a4142..2b7855cd95 100644 --- a/src/Tgstation.Server.Host/Controllers/ComponentInterfacingController.cs +++ b/src/Tgstation.Server.Host/Controllers/ComponentInterfacingController.cs @@ -88,8 +88,7 @@ namespace Tgstation.Server.Host.Controllers /// if an unsaved DB update was made, otherwise. protected bool ValidateInstanceOnlineStatus(Api.Models.Instance metadata) { - if (metadata == null) - throw new ArgumentNullException(nameof(metadata)); + ArgumentNullException.ThrowIfNull(metadata); bool online; using (var instanceReferenceCheck = instanceManager.GetInstanceReference(metadata)) @@ -119,8 +118,7 @@ namespace Tgstation.Server.Host.Controllers /// The context of should be as small as possible so as to avoid race conditions. This function can return a if the requested instance was offline. protected async Task WithComponentInstance(Func> action) { - if (action == null) - throw new ArgumentNullException(nameof(action)); + ArgumentNullException.ThrowIfNull(action); using var instanceReference = instanceManager.GetInstanceReference(Instance); using (LogContext.PushProperty(SerilogContextHelper.InstanceReferenceContextProperty, instanceReference.Uid)) diff --git a/src/Tgstation.Server.Host/Controllers/ConfigurationController.cs b/src/Tgstation.Server.Host/Controllers/ConfigurationController.cs index 61acf2d216..373554c928 100644 --- a/src/Tgstation.Server.Host/Controllers/ConfigurationController.cs +++ b/src/Tgstation.Server.Host/Controllers/ConfigurationController.cs @@ -69,8 +69,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(ConfigurationFileResponse), 202)] public async Task Update([FromBody] ConfigurationFileRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (ForbidDueToModeConflicts(model.Path, out var systemIdentity)) return Forbid(); @@ -234,8 +233,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(ConfigurationFileResponse), 201)] public async Task CreateDirectory([FromBody] ConfigurationFileRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (ForbidDueToModeConflicts(model.Path, out var systemIdentity)) return Forbid(); @@ -285,8 +283,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(204)] public async Task DeleteDirectory([FromBody] ConfigurationFileRequest directory, CancellationToken cancellationToken) { - if (directory == null) - throw new ArgumentNullException(nameof(directory)); + ArgumentNullException.ThrowIfNull(directory); if (directory.Path == null) return BadRequest(new ErrorMessageResponse(ErrorCode.ModelValidationFailure)); diff --git a/src/Tgstation.Server.Host/Controllers/ControlPanelController.cs b/src/Tgstation.Server.Host/Controllers/ControlPanelController.cs index 0e31d946a8..c062420b68 100644 --- a/src/Tgstation.Server.Host/Controllers/ControlPanelController.cs +++ b/src/Tgstation.Server.Host/Controllers/ControlPanelController.cs @@ -88,8 +88,7 @@ namespace Tgstation.Server.Host.Controllers /// public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { - if (context == null) - throw new ArgumentNullException(nameof(context)); + ArgumentNullException.ThrowIfNull(context); var newValues = new List { FetchChannelVaryHeader }; var headers = context.HttpContext.Response.Headers; diff --git a/src/Tgstation.Server.Host/Controllers/DreamDaemonController.cs b/src/Tgstation.Server.Host/Controllers/DreamDaemonController.cs index 0b57cbc87e..e8db5b6d97 100644 --- a/src/Tgstation.Server.Host/Controllers/DreamDaemonController.cs +++ b/src/Tgstation.Server.Host/Controllers/DreamDaemonController.cs @@ -158,8 +158,7 @@ namespace Tgstation.Server.Host.Controllers #pragma warning disable CA1506 public async Task Update([FromBody] DreamDaemonRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (model.SoftShutdown == true && model.SoftRestart == true) return BadRequest(new ErrorMessageResponse(ErrorCode.DreamDaemonDoubleSoft)); diff --git a/src/Tgstation.Server.Host/Controllers/DreamMakerController.cs b/src/Tgstation.Server.Host/Controllers/DreamMakerController.cs index fb0c805f40..d26c23aba2 100644 --- a/src/Tgstation.Server.Host/Controllers/DreamMakerController.cs +++ b/src/Tgstation.Server.Host/Controllers/DreamMakerController.cs @@ -177,8 +177,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(ErrorMessageResponse), 410)] public async Task Update([FromBody] DreamMakerRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (model.ApiValidationPort == 0) throw new InvalidOperationException("ApiValidationPort cannot be 0!"); diff --git a/src/Tgstation.Server.Host/Controllers/InstanceController.cs b/src/Tgstation.Server.Host/Controllers/InstanceController.cs index ca248ef1cb..716d8e9d58 100644 --- a/src/Tgstation.Server.Host/Controllers/InstanceController.cs +++ b/src/Tgstation.Server.Host/Controllers/InstanceController.cs @@ -129,8 +129,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(InstanceResponse), 201)] public async Task Create([FromBody] InstanceCreateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (String.IsNullOrWhiteSpace(model.Name)) return BadRequest(new ErrorMessageResponse(ErrorCode.InstanceWhitespaceName)); @@ -328,8 +327,7 @@ namespace Tgstation.Server.Host.Controllers #pragma warning disable CA1502 // TODO: Decomplexify public async Task Update([FromBody] InstanceUpdateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); IQueryable InstanceQuery() => DatabaseContext .Instances diff --git a/src/Tgstation.Server.Host/Controllers/InstancePermissionSetController.cs b/src/Tgstation.Server.Host/Controllers/InstancePermissionSetController.cs index da32651a38..e0be1eb3b1 100644 --- a/src/Tgstation.Server.Host/Controllers/InstancePermissionSetController.cs +++ b/src/Tgstation.Server.Host/Controllers/InstancePermissionSetController.cs @@ -63,8 +63,7 @@ namespace Tgstation.Server.Host.Controllers #pragma warning disable CA1506 public async Task Create([FromBody] InstancePermissionSetRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); var existingPermissionSet = await DatabaseContext .PermissionSets @@ -127,8 +126,7 @@ namespace Tgstation.Server.Host.Controllers #pragma warning disable CA1506 // TODO: Decomplexify public async Task Update([FromBody] InstancePermissionSetRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); var originalPermissionSet = await DatabaseContext .Instances diff --git a/src/Tgstation.Server.Host/Controllers/LimitedStreamResult.cs b/src/Tgstation.Server.Host/Controllers/LimitedStreamResult.cs index 7a2d38e5ba..1917b53b17 100644 --- a/src/Tgstation.Server.Host/Controllers/LimitedStreamResult.cs +++ b/src/Tgstation.Server.Host/Controllers/LimitedStreamResult.cs @@ -38,8 +38,7 @@ namespace Tgstation.Server.Host.Controllers /// public override Task ExecuteResultAsync(ActionContext context) { - if (context == null) - throw new ArgumentNullException(nameof(context)); + ArgumentNullException.ThrowIfNull(context); var executor = context .HttpContext diff --git a/src/Tgstation.Server.Host/Controllers/LimitedStreamResultExecutor.cs b/src/Tgstation.Server.Host/Controllers/LimitedStreamResultExecutor.cs index bdfa184f28..7a8169c1d3 100644 --- a/src/Tgstation.Server.Host/Controllers/LimitedStreamResultExecutor.cs +++ b/src/Tgstation.Server.Host/Controllers/LimitedStreamResultExecutor.cs @@ -26,11 +26,9 @@ namespace Tgstation.Server.Host.Controllers /// public async Task ExecuteAsync(ActionContext context, LimitedStreamResult result) { - if (context == null) - throw new ArgumentNullException(nameof(context)); + ArgumentNullException.ThrowIfNull(context); - if (result == null) - throw new ArgumentNullException(nameof(result)); + ArgumentNullException.ThrowIfNull(result); await using (result) { diff --git a/src/Tgstation.Server.Host/Controllers/RepositoryController.cs b/src/Tgstation.Server.Host/Controllers/RepositoryController.cs index b27d45530f..6b877c054b 100644 --- a/src/Tgstation.Server.Host/Controllers/RepositoryController.cs +++ b/src/Tgstation.Server.Host/Controllers/RepositoryController.cs @@ -82,8 +82,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(ErrorMessageResponse), 410)] public async Task Create([FromBody] RepositoryCreateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (model.Origin == null) return BadRequest(ErrorCode.ModelValidationFailure); @@ -310,8 +309,7 @@ namespace Tgstation.Server.Host.Controllers public async Task Update([FromBody] RepositoryUpdateRequest model, CancellationToken cancellationToken) #pragma warning restore CA1502 { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (model.AccessUser == null ^ model.AccessToken == null) return BadRequest(new ErrorMessageResponse(ErrorCode.RepoMismatchUserAndAccessToken)); diff --git a/src/Tgstation.Server.Host/Controllers/SwarmController.cs b/src/Tgstation.Server.Host/Controllers/SwarmController.cs index 0bbc78686c..a94599c920 100644 --- a/src/Tgstation.Server.Host/Controllers/SwarmController.cs +++ b/src/Tgstation.Server.Host/Controllers/SwarmController.cs @@ -91,8 +91,7 @@ namespace Tgstation.Server.Host.Controllers [HttpPost(SwarmConstants.RegisterRoute)] public async Task Register([FromBody] SwarmRegistrationRequest registrationRequest, CancellationToken cancellationToken) { - if (registrationRequest == null) - throw new ArgumentNullException(nameof(registrationRequest)); + ArgumentNullException.ThrowIfNull(registrationRequest); if (registrationRequest.ServerVersion != assemblyInformationProvider.Version) return StatusCode((int)HttpStatusCode.UpgradeRequired); @@ -150,8 +149,7 @@ namespace Tgstation.Server.Host.Controllers [HttpPost] public IActionResult UpdateNodeList([FromBody] SwarmServersUpdateRequest serversUpdateRequest) { - if (serversUpdateRequest == null) - throw new ArgumentNullException(nameof(serversUpdateRequest)); + ArgumentNullException.ThrowIfNull(serversUpdateRequest); if (!ValidateRegistration()) return Forbid(); @@ -169,8 +167,7 @@ namespace Tgstation.Server.Host.Controllers [HttpPut(SwarmConstants.UpdateRoute)] public async Task PrepareUpdate([FromBody] SwarmUpdateRequest updateRequest, CancellationToken cancellationToken) { - if (updateRequest == null) - throw new ArgumentNullException(nameof(updateRequest)); + ArgumentNullException.ThrowIfNull(updateRequest); if (!ValidateRegistration()) return Forbid(); diff --git a/src/Tgstation.Server.Host/Controllers/UserController.cs b/src/Tgstation.Server.Host/Controllers/UserController.cs index 4dd7f7b0fc..b50e424c93 100644 --- a/src/Tgstation.Server.Host/Controllers/UserController.cs +++ b/src/Tgstation.Server.Host/Controllers/UserController.cs @@ -84,8 +84,7 @@ namespace Tgstation.Server.Host.Controllers #pragma warning disable CA1502, CA1506 public async Task Create([FromBody] UserCreateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (model.OAuthConnections?.Any(x => x == null) == true) return BadRequest(new ErrorMessageResponse(ErrorCode.ModelValidationFailure)); @@ -171,8 +170,7 @@ namespace Tgstation.Server.Host.Controllers #pragma warning disable CA1506 public async Task Update([FromBody] UserUpdateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (!model.Id.HasValue || model.OAuthConnections?.Any(x => x == null) == true) return BadRequest(new ErrorMessageResponse(ErrorCode.ModelValidationFailure)); diff --git a/src/Tgstation.Server.Host/Controllers/UserGroupController.cs b/src/Tgstation.Server.Host/Controllers/UserGroupController.cs index 743edcf2a5..7b794d86e5 100644 --- a/src/Tgstation.Server.Host/Controllers/UserGroupController.cs +++ b/src/Tgstation.Server.Host/Controllers/UserGroupController.cs @@ -67,8 +67,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(UserGroupResponse), 201)] public async Task Create([FromBody] UserGroupCreateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); if (model.Name == null) return BadRequest(new ErrorMessageResponse(ErrorCode.ModelValidationFailure)); @@ -112,8 +111,7 @@ namespace Tgstation.Server.Host.Controllers [ProducesResponseType(typeof(UserGroupResponse), 200)] public async Task Update([FromBody] UserGroupUpdateRequest model, CancellationToken cancellationToken) { - if (model == null) - throw new ArgumentNullException(nameof(model)); + ArgumentNullException.ThrowIfNull(model); var currentGroup = await DatabaseContext .Groups diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 6679034558..dde2ac996a 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -126,8 +126,7 @@ namespace Tgstation.Server.Host.Core { ConfigureServices(services, assemblyInformationProvider, ioManager); - if (postSetupServices == null) - throw new ArgumentNullException(nameof(postSetupServices)); + ArgumentNullException.ThrowIfNull(postSetupServices); // configure configuration services.UseStandardConfig(Configuration); @@ -405,24 +404,19 @@ namespace Tgstation.Server.Host.Core IOptions swarmConfigurationOptions, ILogger logger) { - if (applicationBuilder == null) - throw new ArgumentNullException(nameof(applicationBuilder)); - if (serverControl == null) - throw new ArgumentNullException(nameof(serverControl)); + ArgumentNullException.ThrowIfNull(applicationBuilder); + ArgumentNullException.ThrowIfNull(serverControl); this.tokenFactory = tokenFactory ?? throw new ArgumentNullException(nameof(tokenFactory)); - if (serverPortProvider == null) - throw new ArgumentNullException(nameof(serverPortProvider)); - if (assemblyInformationProvider == null) - throw new ArgumentNullException(nameof(assemblyInformationProvider)); + ArgumentNullException.ThrowIfNull(serverPortProvider); + ArgumentNullException.ThrowIfNull(assemblyInformationProvider); var controlPanelConfiguration = controlPanelConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(controlPanelConfigurationOptions)); var generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions)); var swarmConfiguration = swarmConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(swarmConfigurationOptions)); - if (logger == null) - throw new ArgumentNullException(nameof(logger)); + ArgumentNullException.ThrowIfNull(logger); logger.LogDebug("Content Root: {contentRoot}", hostingEnvironment.ContentRootPath); logger.LogTrace("Web Root: {webRoot}", hostingEnvironment.WebRootPath); diff --git a/src/Tgstation.Server.Host/Core/ServerPortProivder.cs b/src/Tgstation.Server.Host/Core/ServerPortProivder.cs index 0b5bb6cd12..e4c4927c53 100644 --- a/src/Tgstation.Server.Host/Core/ServerPortProivder.cs +++ b/src/Tgstation.Server.Host/Core/ServerPortProivder.cs @@ -32,8 +32,7 @@ namespace Tgstation.Server.Host.Core ILogger logger) { generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions)); - if (configuration == null) - throw new ArgumentNullException(nameof(configuration)); + ArgumentNullException.ThrowIfNull(configuration); var httpEndpoint = configuration .GetSection("Kestrel") diff --git a/src/Tgstation.Server.Host/Core/ServerUpdater.cs b/src/Tgstation.Server.Host/Core/ServerUpdater.cs index 08c8a35d90..d04386a9b6 100644 --- a/src/Tgstation.Server.Host/Core/ServerUpdater.cs +++ b/src/Tgstation.Server.Host/Core/ServerUpdater.cs @@ -94,11 +94,9 @@ namespace Tgstation.Server.Host.Core /// public async Task BeginUpdate(ISwarmService swarmService, IFileStreamProvider fileStreamProvider, Version version, CancellationToken cancellationToken) { - if (swarmService == null) - throw new ArgumentNullException(nameof(swarmService)); + ArgumentNullException.ThrowIfNull(swarmService); - if (version == null) - throw new ArgumentNullException(nameof(version)); + ArgumentNullException.ThrowIfNull(version); if (!swarmService.ExpectedNumberOfNodesConnected) return ServerUpdateResult.SwarmIntegrityCheckFailed; @@ -109,8 +107,7 @@ namespace Tgstation.Server.Host.Core /// public async Task ExecuteUpdate(string updatePath, CancellationToken cancellationToken, CancellationToken criticalCancellationToken) { - if (updatePath == null) - throw new ArgumentNullException(nameof(updatePath)); + ArgumentNullException.ThrowIfNull(updatePath); var serverUpdateOperation = this.serverUpdateOperation; if (serverUpdateOperation == null) diff --git a/src/Tgstation.Server.Host/Database/DatabaseConnectionFactory.cs b/src/Tgstation.Server.Host/Database/DatabaseConnectionFactory.cs index 4cd12689e2..f3adcaf7f2 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseConnectionFactory.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseConnectionFactory.cs @@ -18,8 +18,7 @@ namespace Tgstation.Server.Host.Database /// public DbConnection CreateConnection(string connectionString, DatabaseType databaseType) { - if (connectionString == null) - throw new ArgumentNullException(nameof(connectionString)); + ArgumentNullException.ThrowIfNull(connectionString); return databaseType switch { diff --git a/src/Tgstation.Server.Host/Database/DatabaseContext.cs b/src/Tgstation.Server.Host/Database/DatabaseContext.cs index 2614ad2329..7309d6e639 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseContext.cs @@ -285,8 +285,7 @@ namespace Tgstation.Server.Host.Database /// public async Task Migrate(ILogger logger, CancellationToken cancellationToken) { - if (logger == null) - throw new ArgumentNullException(nameof(logger)); + ArgumentNullException.ThrowIfNull(logger); var migrations = await Database.GetAppliedMigrationsAsync(cancellationToken); var wasEmpty = !migrations.Any(); @@ -306,8 +305,7 @@ namespace Tgstation.Server.Host.Database /// protected override void OnModelCreating(ModelBuilder modelBuilder) { - if (modelBuilder == null) - throw new ArgumentNullException(nameof(modelBuilder)); + ArgumentNullException.ThrowIfNull(modelBuilder); base.OnModelCreating(modelBuilder); @@ -404,10 +402,8 @@ namespace Tgstation.Server.Host.Database DatabaseType currentDatabaseType, CancellationToken cancellationToken) { - if (logger == null) - throw new ArgumentNullException(nameof(logger)); - if (targetVersion == null) - throw new ArgumentNullException(nameof(targetVersion)); + ArgumentNullException.ThrowIfNull(logger); + ArgumentNullException.ThrowIfNull(targetVersion); if (targetVersion < new Version(4, 0)) throw new ArgumentOutOfRangeException(nameof(targetVersion), targetVersion, "Cannot migrate below version 4.0.0!"); diff --git a/src/Tgstation.Server.Host/Database/DatabaseContextFactory.cs b/src/Tgstation.Server.Host/Database/DatabaseContextFactory.cs index 7f4bc19049..0f6a4fcebd 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseContextFactory.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseContextFactory.cs @@ -28,8 +28,7 @@ namespace Tgstation.Server.Host.Database /// public async Task UseContext(Func operation) { - if (operation == null) - throw new ArgumentNullException(nameof(operation)); + ArgumentNullException.ThrowIfNull(operation); await using var scope = scopeFactory.CreateAsyncScope(); await operation(scope.ServiceProvider.GetRequiredService()); diff --git a/src/Tgstation.Server.Host/Database/DatabaseSeeder.cs b/src/Tgstation.Server.Host/Database/DatabaseSeeder.cs index 66e74968e0..00188bfd7f 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseSeeder.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseSeeder.cs @@ -104,8 +104,7 @@ namespace Tgstation.Server.Host.Database /// public async Task Initialize(IDatabaseContext databaseContext, CancellationToken cancellationToken) { - if (databaseContext == null) - throw new ArgumentNullException(nameof(databaseContext)); + ArgumentNullException.ThrowIfNull(databaseContext); if (databaseConfiguration.DropDatabase) { @@ -134,10 +133,8 @@ namespace Tgstation.Server.Host.Database /// public Task Downgrade(IDatabaseContext databaseContext, Version downgradeVersion, CancellationToken cancellationToken) { - if (databaseContext == null) - throw new ArgumentNullException(nameof(databaseContext)); - if (downgradeVersion == null) - throw new ArgumentNullException(nameof(downgradeVersion)); + ArgumentNullException.ThrowIfNull(databaseContext); + ArgumentNullException.ThrowIfNull(downgradeVersion); return databaseContext.SchemaDowngradeForServerVersion( databaseLogger, diff --git a/src/Tgstation.Server.Host/Database/Migrations/20180906135553_MSInitialCreate.cs b/src/Tgstation.Server.Host/Database/Migrations/20180906135553_MSInitialCreate.cs index d4e3002fff..088171a439 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20180906135553_MSInitialCreate.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20180906135553_MSInitialCreate.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "Users", @@ -594,8 +593,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_Jobs_Instances_InstanceId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20180906143029_MYInitialCreate.cs b/src/Tgstation.Server.Host/Database/Migrations/20180906143029_MYInitialCreate.cs index 0b2638a0d5..dd5e944b30 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20180906143029_MYInitialCreate.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20180906143029_MYInitialCreate.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "Users", @@ -591,8 +590,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_Jobs_Instances_InstanceId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20180918020726_MYAddMinimumSecurity.cs b/src/Tgstation.Server.Host/Database/Migrations/20180918020726_MYAddMinimumSecurity.cs index 1a34b44c9b..3e7761dfab 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20180918020726_MYAddMinimumSecurity.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20180918020726_MYAddMinimumSecurity.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "ApiValidationSecurityLevel", @@ -33,8 +32,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ApiValidationSecurityLevel", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20180918021228_MSAddMinimumSecurity.cs b/src/Tgstation.Server.Host/Database/Migrations/20180918021228_MSAddMinimumSecurity.cs index 57d8541ed9..9eaa14c49f 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20180918021228_MSAddMinimumSecurity.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20180918021228_MSAddMinimumSecurity.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "ApiValidationSecurityLevel", @@ -33,8 +32,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ApiValidationSecurityLevel", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20180918204520_MYNullableAndForeignKeyCleanup.cs b/src/Tgstation.Server.Host/Database/Migrations/20180918204520_MYNullableAndForeignKeyCleanup.cs index e510a62925..d619944172 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20180918204520_MYNullableAndForeignKeyCleanup.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20180918204520_MYNullableAndForeignKeyCleanup.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_Instances_WatchdogReattachInformations_WatchdogReattachInfor~", @@ -120,8 +119,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20180918205224_MSNullableAndForeignKeyCleanup.cs b/src/Tgstation.Server.Host/Database/Migrations/20180918205224_MSNullableAndForeignKeyCleanup.cs index a25ee2d2fc..fb6fdf369f 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20180918205224_MSNullableAndForeignKeyCleanup.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20180918205224_MSNullableAndForeignKeyCleanup.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_Instances_WatchdogReattachInformations_WatchdogReattachInformationId", @@ -118,8 +117,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20180926033145_MSReattachCompileJobRequired.cs b/src/Tgstation.Server.Host/Database/Migrations/20180926033145_MSReattachCompileJobRequired.cs index d2bb7d4c33..0b48f75c5d 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20180926033145_MSReattachCompileJobRequired.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20180926033145_MSReattachCompileJobRequired.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ReattachInformations_CompileJobs_CompileJobId", @@ -38,8 +37,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ReattachInformations_CompileJobs_CompileJobId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20180926034014_MYReattachCompileJobRequired.cs b/src/Tgstation.Server.Host/Database/Migrations/20180926034014_MYReattachCompileJobRequired.cs index 0d75aa9fc6..e883ac25e8 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20180926034014_MYReattachCompileJobRequired.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20180926034014_MYReattachCompileJobRequired.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ReattachInformations_CompileJobs_CompileJobId", @@ -38,8 +37,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ReattachInformations_CompileJobs_CompileJobId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20181124231534_MSToggleTestmergeComments.cs b/src/Tgstation.Server.Host/Database/Migrations/20181124231534_MSToggleTestmergeComments.cs index caa9334cb4..30b821ee66 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20181124231534_MSToggleTestmergeComments.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20181124231534_MSToggleTestmergeComments.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "PostTestMergeComment", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "PostTestMergeComment", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20181124231549_MYToggleTestmergeComments.cs b/src/Tgstation.Server.Host/Database/Migrations/20181124231549_MYToggleTestmergeComments.cs index 9290890501..f91e86a6db 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20181124231549_MYToggleTestmergeComments.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20181124231549_MYToggleTestmergeComments.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "PostTestMergeComment", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "PostTestMergeComment", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20190219041825_MSFixRevInfoIndex.cs b/src/Tgstation.Server.Host/Database/Migrations/20190219041825_MSFixRevInfoIndex.cs index af0ad1e571..b75fbb3f89 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20190219041825_MSFixRevInfoIndex.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20190219041825_MSFixRevInfoIndex.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_RevisionInformations_CommitSha", @@ -33,8 +32,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_RevisionInformations_InstanceId_CommitSha", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20190219042440_MYFixRevInfoIndex.cs b/src/Tgstation.Server.Host/Database/Migrations/20190219042440_MYFixRevInfoIndex.cs index b0ae958180..8052a32e7c 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20190219042440_MYFixRevInfoIndex.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20190219042440_MYFixRevInfoIndex.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_RevisionInformations_Instances_InstanceId", @@ -45,8 +44,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_RevisionInformations_Instances_InstanceId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200121170252_MSAddChatBotReconnectionInterval.cs b/src/Tgstation.Server.Host/Database/Migrations/20200121170252_MSAddChatBotReconnectionInterval.cs index 73605646d3..b805c48f98 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200121170252_MSAddChatBotReconnectionInterval.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200121170252_MSAddChatBotReconnectionInterval.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "ReconnectionInterval", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ReconnectionInterval", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200121171159_MYAddChatBotReconnectionInterval.cs b/src/Tgstation.Server.Host/Database/Migrations/20200121171159_MYAddChatBotReconnectionInterval.cs index d5280c4521..fceface511 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200121171159_MYAddChatBotReconnectionInterval.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200121171159_MYAddChatBotReconnectionInterval.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "ReconnectionInterval", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ReconnectionInterval", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200411164808_MSTonsOfValidation.cs b/src/Tgstation.Server.Host/Database/Migrations/20200411164808_MSTonsOfValidation.cs index 904e6684a4..c6c3fe0b4d 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200411164808_MSTonsOfValidation.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200411164808_MSTonsOfValidation.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ChatBots_Instances_InstanceId", @@ -99,8 +98,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ChatBots_Instances_InstanceId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200411170010_MYTonsOfValidation.cs b/src/Tgstation.Server.Host/Database/Migrations/20200411170010_MYTonsOfValidation.cs index bce2468d95..e67e3d4508 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200411170010_MYTonsOfValidation.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200411170010_MYTonsOfValidation.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ChatBots_Instances_InstanceId", @@ -98,8 +97,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ChatBots_Instances_InstanceId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200420175359_MSLimitsOnChat.cs b/src/Tgstation.Server.Host/Database/Migrations/20200420175359_MSLimitsOnChat.cs index 560681d834..9f5f4c244b 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200420175359_MSLimitsOnChat.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200420175359_MSLimitsOnChat.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "ChatBotLimit", @@ -33,8 +32,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ChatBotLimit", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200420181015_MYLimitsOnChat.cs b/src/Tgstation.Server.Host/Database/Migrations/20200420181015_MYLimitsOnChat.cs index e1c2828f11..2f23848708 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200420181015_MYLimitsOnChat.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200420181015_MYLimitsOnChat.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "ChatBotLimit", @@ -33,8 +32,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ChatBotLimit", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200422001202_MSAddCompileJobDMApiVersion.cs b/src/Tgstation.Server.Host/Database/Migrations/20200422001202_MSAddCompileJobDMApiVersion.cs index f4c1bcc7cd..e0a2d18399 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200422001202_MSAddCompileJobDMApiVersion.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200422001202_MSAddCompileJobDMApiVersion.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ServerCommandsJson", @@ -38,8 +37,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "DMApiMajorVersion", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200422010115_MYAddCompileJobDMApiVersion.cs b/src/Tgstation.Server.Host/Database/Migrations/20200422010115_MYAddCompileJobDMApiVersion.cs index 63126d4b00..75cb26f458 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200422010115_MYAddCompileJobDMApiVersion.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200422010115_MYAddCompileJobDMApiVersion.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ServerCommandsJson", @@ -38,8 +37,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "DMApiMajorVersion", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200423052142_MSKillJsonsAddDMApiVersion.cs b/src/Tgstation.Server.Host/Database/Migrations/20200423052142_MSKillJsonsAddDMApiVersion.cs index d419b4d6de..6c919a0eab 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200423052142_MSKillJsonsAddDMApiVersion.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200423052142_MSKillJsonsAddDMApiVersion.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ChatChannelsJson", @@ -33,8 +32,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LaunchSecurityLevel", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200423052709_MYKillJsonsAddDMApiVersion.cs b/src/Tgstation.Server.Host/Database/Migrations/20200423052709_MYKillJsonsAddDMApiVersion.cs index 42c4087674..0d09dbb44c 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200423052709_MYKillJsonsAddDMApiVersion.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200423052709_MYKillJsonsAddDMApiVersion.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ChatChannelsJson", @@ -33,8 +32,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LaunchSecurityLevel", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200425024433_MSAddJobErrorCodes.cs b/src/Tgstation.Server.Host/Database/Migrations/20200425024433_MSAddJobErrorCodes.cs index 9a672617ee..bd639e67d5 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200425024433_MSAddJobErrorCodes.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200425024433_MSAddJobErrorCodes.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "ErrorCode", @@ -24,8 +23,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ErrorCode", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200425024953_MYAddJobErrorCodes.cs b/src/Tgstation.Server.Host/Database/Migrations/20200425024953_MYAddJobErrorCodes.cs index 8ad2ccc82d..800b7c0ebd 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200425024953_MYAddJobErrorCodes.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200425024953_MYAddJobErrorCodes.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "ErrorCode", @@ -24,8 +23,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "ErrorCode", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200427173852_MSFixCascadingDelete.cs b/src/Tgstation.Server.Host/Database/Migrations/20200427173852_MSFixCascadingDelete.cs index 8e4e647199..32791b2130 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200427173852_MSFixCascadingDelete.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200427173852_MSFixCascadingDelete.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_CompileJobs_Jobs_JobId", @@ -65,8 +64,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_CompileJobs_Jobs_JobId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200427180159_MYFixCascadingDelete.cs b/src/Tgstation.Server.Host/Database/Migrations/20200427180159_MYFixCascadingDelete.cs index f99058c010..a87cce1c7c 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200427180159_MYFixCascadingDelete.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200427180159_MYFixCascadingDelete.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_CompileJobs_Jobs_JobId", @@ -65,8 +64,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_CompileJobs_Jobs_JobId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200427180904_SLRebuild.cs b/src/Tgstation.Server.Host/Database/Migrations/20200427180904_SLRebuild.cs index 29424cbb35..046b6e19e1 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200427180904_SLRebuild.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200427180904_SLRebuild.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "Instances", @@ -591,8 +590,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "ChatChannels"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200511005957_MSAddHeartbeat.cs b/src/Tgstation.Server.Host/Database/Migrations/20200511005957_MSAddHeartbeat.cs index 91e0288a4f..af8c68f9b2 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200511005957_MSAddHeartbeat.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200511005957_MSAddHeartbeat.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "HeartbeatSeconds", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "HeartbeatSeconds", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200511011048_MYAddHeartbeat.cs b/src/Tgstation.Server.Host/Database/Migrations/20200511011048_MYAddHeartbeat.cs index 4a4c67074c..00fd571851 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200511011048_MYAddHeartbeat.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200511011048_MYAddHeartbeat.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "HeartbeatSeconds", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "HeartbeatSeconds", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200511012117_SLAddHeartbeat.cs b/src/Tgstation.Server.Host/Database/Migrations/20200511012117_SLAddHeartbeat.cs index fe03be2ab9..169c5abe9f 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200511012117_SLAddHeartbeat.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200511012117_SLAddHeartbeat.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "HeartbeatSeconds", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "DreamDaemonSettings", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200511162912_SLRemoveSoftColumns.cs b/src/Tgstation.Server.Host/Database/Migrations/20200511162912_SLRemoveSoftColumns.cs index 91a5f08dc5..96fadcbd4f 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200511162912_SLRemoveSoftColumns.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200511162912_SLRemoveSoftColumns.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "DreamDaemonSettings", @@ -55,8 +54,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "AccessToken", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200512181801_MSRemoveSoftColumns.cs b/src/Tgstation.Server.Host/Database/Migrations/20200512181801_MSRemoveSoftColumns.cs index 4aa9405537..e248ffdb85 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200512181801_MSRemoveSoftColumns.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200512181801_MSRemoveSoftColumns.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "AccessToken", @@ -35,8 +34,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "AccessToken", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200512182535_MYRemoveSoftColumns.cs b/src/Tgstation.Server.Host/Database/Migrations/20200512182535_MYRemoveSoftColumns.cs index 98167ac4dd..5ddb6033c8 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200512182535_MYRemoveSoftColumns.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200512182535_MYRemoveSoftColumns.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "AccessToken", @@ -35,8 +34,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "AccessToken", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200516111712_PGCreate.cs b/src/Tgstation.Server.Host/Database/Migrations/20200516111712_PGCreate.cs index 66e77f48c4..f58ab709ac 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200516111712_PGCreate.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200516111712_PGCreate.cs @@ -13,8 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "Instances", @@ -588,8 +587,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "ChatChannels"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200529171541_MYFixForeignKey.cs b/src/Tgstation.Server.Host/Database/Migrations/20200529171541_MYFixForeignKey.cs index 73f81043cd..8466503faa 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200529171541_MYFixForeignKey.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200529171541_MYFixForeignKey.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_CompileJobs_RevisionInformations_RevisionInformationId", @@ -31,8 +30,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_CompileJobs_RevisionInformations_RevisionInformationId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200616175424_MSTopicTimeout.cs b/src/Tgstation.Server.Host/Database/Migrations/20200616175424_MSTopicTimeout.cs index c36ed80596..79f6159877 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200616175424_MSTopicTimeout.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200616175424_MSTopicTimeout.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "TopicRequestTimeout", table: "DreamDaemonSettings", @@ -24,8 +23,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "TopicRequestTimeout", table: "DreamDaemonSettings"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200616175535_MYTopicTimeout.cs b/src/Tgstation.Server.Host/Database/Migrations/20200616175535_MYTopicTimeout.cs index 8a7823712a..8dcd28f755 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200616175535_MYTopicTimeout.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200616175535_MYTopicTimeout.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "TopicRequestTimeout", table: "DreamDaemonSettings", @@ -24,8 +23,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "TopicRequestTimeout", table: "DreamDaemonSettings"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200616180742_SLTopicTimeout.cs b/src/Tgstation.Server.Host/Database/Migrations/20200616180742_SLTopicTimeout.cs index f6cb755644..89e0f40726 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200616180742_SLTopicTimeout.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200616180742_SLTopicTimeout.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "TopicRequestTimeout", table: "DreamDaemonSettings", @@ -24,8 +23,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "DreamDaemonSettings", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200616180842_PGTopicTimeout.cs b/src/Tgstation.Server.Host/Database/Migrations/20200616180842_PGTopicTimeout.cs index c340ab68ee..60d970d042 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200616180842_PGTopicTimeout.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200616180842_PGTopicTimeout.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "TopicRequestTimeout", table: "DreamDaemonSettings", @@ -24,8 +23,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "TopicRequestTimeout", table: "DreamDaemonSettings"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200629184803_MSRemoveExperimentalWatchdog.cs b/src/Tgstation.Server.Host/Database/Migrations/20200629184803_MSRemoveExperimentalWatchdog.cs index a2803dca9a..26f6d0620c 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200629184803_MSRemoveExperimentalWatchdog.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200629184803_MSRemoveExperimentalWatchdog.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "WatchdogReattachInformations"); @@ -35,8 +34,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "Port", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200629184843_MYRemoveExperimentalWatchdog.cs b/src/Tgstation.Server.Host/Database/Migrations/20200629184843_MYRemoveExperimentalWatchdog.cs index 0412818df9..6bd6510ec1 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200629184843_MYRemoveExperimentalWatchdog.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200629184843_MYRemoveExperimentalWatchdog.cs @@ -13,8 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "WatchdogReattachInformations"); @@ -36,8 +35,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "Port", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200629184928_PGRemoveExperimentalWatchdog.cs b/src/Tgstation.Server.Host/Database/Migrations/20200629184928_PGRemoveExperimentalWatchdog.cs index a8055fd520..459300d72a 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200629184928_PGRemoveExperimentalWatchdog.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200629184928_PGRemoveExperimentalWatchdog.cs @@ -13,8 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "WatchdogReattachInformations"); @@ -36,8 +35,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "Port", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200629185014_SLRemoveExperimentalWatchdog.cs b/src/Tgstation.Server.Host/Database/Migrations/20200629185014_SLRemoveExperimentalWatchdog.cs index 00ea3bdca4..71365a1adb 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200629185014_SLRemoveExperimentalWatchdog.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200629185014_SLRemoveExperimentalWatchdog.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "WatchdogReattachInformations"); @@ -92,8 +91,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "Port", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200705163512_MSAllowNullDMApi.cs b/src/Tgstation.Server.Host/Database/Migrations/20200705163512_MSAllowNullDMApi.cs index 0ccc774fcc..7521bd40ac 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200705163512_MSAllowNullDMApi.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200705163512_MSAllowNullDMApi.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "RequireDMApiValidation", @@ -32,8 +31,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "RequireDMApiValidation", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200705163547_MYAllowNullDMApi.cs b/src/Tgstation.Server.Host/Database/Migrations/20200705163547_MYAllowNullDMApi.cs index 67a0816521..fc0b8857ed 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200705163547_MYAllowNullDMApi.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200705163547_MYAllowNullDMApi.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "RequireDMApiValidation", @@ -32,8 +31,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "RequireDMApiValidation", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200705163624_PGAllowNullDMApi.cs b/src/Tgstation.Server.Host/Database/Migrations/20200705163624_PGAllowNullDMApi.cs index da71528e81..8571bffaad 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200705163624_PGAllowNullDMApi.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200705163624_PGAllowNullDMApi.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "RequireDMApiValidation", @@ -32,8 +31,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "RequireDMApiValidation", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200705163700_SLAllowNullDMApi.cs b/src/Tgstation.Server.Host/Database/Migrations/20200705163700_SLAllowNullDMApi.cs index 7fa20fb8df..b55da2c0b6 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200705163700_SLAllowNullDMApi.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200705163700_SLAllowNullDMApi.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "RequireDMApiValidation", @@ -79,8 +78,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "CompileJobs", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200807213255_MSAddDeploymentColumns.cs b/src/Tgstation.Server.Host/Database/Migrations/20200807213255_MSAddDeploymentColumns.cs index c6199ef0d9..affe5764ec 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200807213255_MSAddDeploymentColumns.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200807213255_MSAddDeploymentColumns.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "CreateGitHubDeployments", @@ -35,8 +34,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "CreateGitHubDeployments", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200807213742_MYAddDeploymentColumns.cs b/src/Tgstation.Server.Host/Database/Migrations/20200807213742_MYAddDeploymentColumns.cs index 29e61f3f4e..8a7c120bdc 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200807213742_MYAddDeploymentColumns.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200807213742_MYAddDeploymentColumns.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "CreateGitHubDeployments", @@ -35,8 +34,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "CreateGitHubDeployments", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200807214330_PGAddDeploymentColumns.cs b/src/Tgstation.Server.Host/Database/Migrations/20200807214330_PGAddDeploymentColumns.cs index 3662c7d8f4..dd5c02c094 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200807214330_PGAddDeploymentColumns.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200807214330_PGAddDeploymentColumns.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "CreateGitHubDeployments", @@ -35,8 +34,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "CreateGitHubDeployments", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20200807214754_SLAddDeploymentColumns.cs b/src/Tgstation.Server.Host/Database/Migrations/20200807214754_SLAddDeploymentColumns.cs index cac8ffab88..e219807fb3 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20200807214754_SLAddDeploymentColumns.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20200807214754_SLAddDeploymentColumns.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "CreateGitHubDeployments", @@ -35,8 +34,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "RepositorySettings", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201106082502_MSAddAdditionalDDParameters.cs b/src/Tgstation.Server.Host/Database/Migrations/20201106082502_MSAddAdditionalDDParameters.cs index 538fc0bbe9..1bbd112d84 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201106082502_MSAddAdditionalDDParameters.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201106082502_MSAddAdditionalDDParameters.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "AdditionalParameters", @@ -26,8 +25,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "AdditionalParameters", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201106082556_MYAddAdditionalDDParameters.cs b/src/Tgstation.Server.Host/Database/Migrations/20201106082556_MYAddAdditionalDDParameters.cs index 41a1453aea..bd23eb0b35 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201106082556_MYAddAdditionalDDParameters.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201106082556_MYAddAdditionalDDParameters.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "AdditionalParameters", @@ -33,8 +32,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "AdditionalParameters", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201106082653_PGAddAdditionalDDParameters.cs b/src/Tgstation.Server.Host/Database/Migrations/20201106082653_PGAddAdditionalDDParameters.cs index 8b16888279..d61ad0ef98 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201106082653_PGAddAdditionalDDParameters.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201106082653_PGAddAdditionalDDParameters.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "AdditionalParameters", @@ -26,8 +25,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "AdditionalParameters", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201106082741_SLAddAdditionalDDParameters.cs b/src/Tgstation.Server.Host/Database/Migrations/20201106082741_SLAddAdditionalDDParameters.cs index 3230ec43eb..6a5ebf4c82 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201106082741_SLAddAdditionalDDParameters.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201106082741_SLAddAdditionalDDParameters.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "AdditionalParameters", @@ -26,8 +25,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "DreamDaemonSettings", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201122231219_MSAddOAuthConnections.cs b/src/Tgstation.Server.Host/Database/Migrations/20201122231219_MSAddOAuthConnections.cs index 1d0cae4f64..8ae3bc1cd5 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201122231219_MSAddOAuthConnections.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201122231219_MSAddOAuthConnections.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "OAuthConnections", @@ -51,8 +50,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "OAuthConnections"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201122231327_MYAddOAuthConnections.cs b/src/Tgstation.Server.Host/Database/Migrations/20201122231327_MYAddOAuthConnections.cs index 88a4df4e18..a9a5c7c0b1 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201122231327_MYAddOAuthConnections.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201122231327_MYAddOAuthConnections.cs @@ -13,8 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "OAuthConnections", @@ -52,8 +51,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "OAuthConnections"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201122231443_PGAddOAuthConnections.cs b/src/Tgstation.Server.Host/Database/Migrations/20201122231443_PGAddOAuthConnections.cs index 2ad4c50a12..d2acb241f0 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201122231443_PGAddOAuthConnections.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201122231443_PGAddOAuthConnections.cs @@ -13,8 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "OAuthConnections", @@ -52,8 +51,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "OAuthConnections"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201122231546_SLAddOAuthConnections.cs b/src/Tgstation.Server.Host/Database/Migrations/20201122231546_SLAddOAuthConnections.cs index e9ef148ac8..02764e4837 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201122231546_SLAddOAuthConnections.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201122231546_SLAddOAuthConnections.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "OAuthConnections", @@ -51,8 +50,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropTable( name: "OAuthConnections"); diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201209194250_MSGenericTestMergingUpdate.cs b/src/Tgstation.Server.Host/Database/Migrations/20201209194250_MSGenericTestMergingUpdate.cs index be16bbe72b..1d37b175fb 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201209194250_MSGenericTestMergingUpdate.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201209194250_MSGenericTestMergingUpdate.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "PullRequestRevision", @@ -29,8 +28,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "TargetCommitSha", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201209194348_MYGenericTestMergingUpdate.cs b/src/Tgstation.Server.Host/Database/Migrations/20201209194348_MYGenericTestMergingUpdate.cs index 63d4e18cb5..11f2cd6564 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201209194348_MYGenericTestMergingUpdate.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201209194348_MYGenericTestMergingUpdate.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "PullRequestRevision", @@ -29,8 +28,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "TargetCommitSha", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201209194500_PGGenericTestMergingUpdate.cs b/src/Tgstation.Server.Host/Database/Migrations/20201209194500_PGGenericTestMergingUpdate.cs index fe0b34f8c9..c1a432d7fc 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201209194500_PGGenericTestMergingUpdate.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201209194500_PGGenericTestMergingUpdate.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "PullRequestRevision", @@ -29,8 +28,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "TargetCommitSha", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201209194554_SLGenericTestMergingUpdate.cs b/src/Tgstation.Server.Host/Database/Migrations/20201209194554_SLGenericTestMergingUpdate.cs index ef9ee91ec7..129c893c5a 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201209194554_SLGenericTestMergingUpdate.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201209194554_SLGenericTestMergingUpdate.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "PullRequestRevision", @@ -29,8 +28,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameColumn( name: "TargetCommitSha", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201214181824_MSAddUserGroups.cs b/src/Tgstation.Server.Host/Database/Migrations/20201214181824_MSAddUserGroups.cs index a11ca56d8f..460413f1d4 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201214181824_MSAddUserGroups.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201214181824_MSAddUserGroups.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "SystemIdentifier", @@ -185,8 +184,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "SystemIdentifier", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201214181914_MYAddUserGroups.cs b/src/Tgstation.Server.Host/Database/Migrations/20201214181914_MYAddUserGroups.cs index ff0e88f012..8d41787650 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201214181914_MYAddUserGroups.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201214181914_MYAddUserGroups.cs @@ -13,8 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "SystemIdentifier", @@ -184,8 +183,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "SystemIdentifier", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201214182008_PGAddUserGroups.cs b/src/Tgstation.Server.Host/Database/Migrations/20201214182008_PGAddUserGroups.cs index c918ba2634..cd7c02d135 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201214182008_PGAddUserGroups.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201214182008_PGAddUserGroups.cs @@ -13,8 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "SystemIdentifier", @@ -184,8 +183,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "SystemIdentifier", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201214182101_SLAddUserGroups.cs b/src/Tgstation.Server.Host/Database/Migrations/20201214182101_SLAddUserGroups.cs index d5b760f1be..fad17a2853 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201214182101_SLAddUserGroups.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201214182101_SLAddUserGroups.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "GroupId", @@ -193,8 +192,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.CreateTable( name: "InstanceUsers", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201222175310_MSAddSwarmIdentifer.cs b/src/Tgstation.Server.Host/Database/Migrations/20201222175310_MSAddSwarmIdentifer.cs index 085a0c9c7c..2046b5a370 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201222175310_MSAddSwarmIdentifer.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201222175310_MSAddSwarmIdentifer.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_Instances_Path", @@ -35,8 +34,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_Instances_Path_SwarmIdentifer", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201222175357_MYAddSwarmIdentifer.cs b/src/Tgstation.Server.Host/Database/Migrations/20201222175357_MYAddSwarmIdentifer.cs index 702d6b7125..a8997c4227 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201222175357_MYAddSwarmIdentifer.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201222175357_MYAddSwarmIdentifer.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_Instances_Path", @@ -34,8 +33,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_Instances_Path_SwarmIdentifer", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201222175444_PGAddSwarmIdentifer.cs b/src/Tgstation.Server.Host/Database/Migrations/20201222175444_PGAddSwarmIdentifer.cs index 9a392fa2e0..815d00a246 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201222175444_PGAddSwarmIdentifer.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201222175444_PGAddSwarmIdentifer.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_Instances_Path", @@ -34,8 +33,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_Instances_Path_SwarmIdentifer", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20201222175532_SLAddSwarmIdentifer.cs b/src/Tgstation.Server.Host/Database/Migrations/20201222175532_SLAddSwarmIdentifer.cs index de30adbb85..ef00b51b1c 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20201222175532_SLAddSwarmIdentifer.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20201222175532_SLAddSwarmIdentifer.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropIndex( name: "IX_Instances_Path", @@ -34,8 +33,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "Instances", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210112154040_MSAddRevInfoTimestamp.cs b/src/Tgstation.Server.Host/Database/Migrations/20210112154040_MSAddRevInfoTimestamp.cs index 17bc2f30c3..197a975ca8 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210112154040_MSAddRevInfoTimestamp.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210112154040_MSAddRevInfoTimestamp.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "Timestamp", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "Timestamp", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210112154123_MYAddRevInfoTimestamp.cs b/src/Tgstation.Server.Host/Database/Migrations/20210112154123_MYAddRevInfoTimestamp.cs index 305e977673..275424e8bc 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210112154123_MYAddRevInfoTimestamp.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210112154123_MYAddRevInfoTimestamp.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "Timestamp", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "Timestamp", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210112154203_PGAddRevInfoTimestamp.cs b/src/Tgstation.Server.Host/Database/Migrations/20210112154203_PGAddRevInfoTimestamp.cs index 0100c8cd4f..31b62ae53c 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210112154203_PGAddRevInfoTimestamp.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210112154203_PGAddRevInfoTimestamp.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "Timestamp", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "Timestamp", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210112154243_SLAddRevInfoTimestamp.cs b/src/Tgstation.Server.Host/Database/Migrations/20210112154243_SLAddRevInfoTimestamp.cs index abacc20520..ca5c02fc7b 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210112154243_SLAddRevInfoTimestamp.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210112154243_SLAddRevInfoTimestamp.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "Timestamp", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "RevisionInformations", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210211173222_MSTruncateInstanceNames.cs b/src/Tgstation.Server.Host/Database/Migrations/20210211173222_MSTruncateInstanceNames.cs index aa413eb97e..59618057d0 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210211173222_MSTruncateInstanceNames.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210211173222_MSTruncateInstanceNames.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "Name", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "Name", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210211173316_MYTruncateInstanceNames.cs b/src/Tgstation.Server.Host/Database/Migrations/20210211173316_MYTruncateInstanceNames.cs index b3dbc46de5..9c21c6bdea 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210211173316_MYTruncateInstanceNames.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210211173316_MYTruncateInstanceNames.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "Name", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "Name", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210211173407_PGTruncateInstanceNames.cs b/src/Tgstation.Server.Host/Database/Migrations/20210211173407_PGTruncateInstanceNames.cs index 74970c6db1..d17ab94284 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210211173407_PGTruncateInstanceNames.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210211173407_PGTruncateInstanceNames.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "Name", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AlterColumn( name: "Name", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210825163342_MSAddDreamDaemonVisibility.cs b/src/Tgstation.Server.Host/Database/Migrations/20210825163342_MSAddDreamDaemonVisibility.cs index 3923b974ce..51184b686d 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210825163342_MSAddDreamDaemonVisibility.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210825163342_MSAddDreamDaemonVisibility.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "LaunchVisibility", @@ -31,8 +30,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LaunchVisibility", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210825163433_MYAddDreamDaemonVisibility.cs b/src/Tgstation.Server.Host/Database/Migrations/20210825163433_MYAddDreamDaemonVisibility.cs index d47aa8cea8..66f38ecc64 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210825163433_MYAddDreamDaemonVisibility.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210825163433_MYAddDreamDaemonVisibility.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "LaunchVisibility", @@ -31,8 +30,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LaunchVisibility", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210825163520_PGAddDreamDaemonVisibility.cs b/src/Tgstation.Server.Host/Database/Migrations/20210825163520_PGAddDreamDaemonVisibility.cs index 48fbf56257..2bf5315ea5 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210825163520_PGAddDreamDaemonVisibility.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210825163520_PGAddDreamDaemonVisibility.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "LaunchVisibility", @@ -31,8 +30,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LaunchVisibility", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210825163612_SLAddDreamDaemonVisibility.cs b/src/Tgstation.Server.Host/Database/Migrations/20210825163612_SLAddDreamDaemonVisibility.cs index 82965676ba..d87861eeb6 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210825163612_SLAddDreamDaemonVisibility.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210825163612_SLAddDreamDaemonVisibility.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "LaunchVisibility", @@ -31,8 +30,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "ReattachInformations", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210826213501_MSAddDeploymentTimeout.cs b/src/Tgstation.Server.Host/Database/Migrations/20210826213501_MSAddDeploymentTimeout.cs index 39756daafb..108d9785eb 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210826213501_MSAddDeploymentTimeout.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210826213501_MSAddDeploymentTimeout.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "Timeout", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "Timeout", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210826213652_MYAddDeploymentTimeout.cs b/src/Tgstation.Server.Host/Database/Migrations/20210826213652_MYAddDeploymentTimeout.cs index 3f98048e0f..ad13ff3081 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210826213652_MYAddDeploymentTimeout.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210826213652_MYAddDeploymentTimeout.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "Timeout", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "Timeout", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210826213805_PGAddDeploymentTimeout.cs b/src/Tgstation.Server.Host/Database/Migrations/20210826213805_PGAddDeploymentTimeout.cs index 23223cbe4c..440fab2be6 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210826213805_PGAddDeploymentTimeout.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210826213805_PGAddDeploymentTimeout.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "Timeout", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "Timeout", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210826214006_SLAddDeploymentTimeout.cs b/src/Tgstation.Server.Host/Database/Migrations/20210826214006_SLAddDeploymentTimeout.cs index 22b370fac2..364e5e736c 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210826214006_SLAddDeploymentTimeout.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210826214006_SLAddDeploymentTimeout.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "Timeout", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "DreamMakerSettings", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210828183711_MSAddUpdateSubmodules.cs b/src/Tgstation.Server.Host/Database/Migrations/20210828183711_MSAddUpdateSubmodules.cs index 43d8b74499..327b066e34 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210828183711_MSAddUpdateSubmodules.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210828183711_MSAddUpdateSubmodules.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "UpdateSubmodules", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "UpdateSubmodules", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210828183801_MYAddUpdateSubmodules.cs b/src/Tgstation.Server.Host/Database/Migrations/20210828183801_MYAddUpdateSubmodules.cs index e948d41d7d..4d3f56a75e 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210828183801_MYAddUpdateSubmodules.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210828183801_MYAddUpdateSubmodules.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "UpdateSubmodules", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "UpdateSubmodules", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210828183859_PGAddUpdateSubmodules.cs b/src/Tgstation.Server.Host/Database/Migrations/20210828183859_PGAddUpdateSubmodules.cs index 197b396756..954d144743 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210828183859_PGAddUpdateSubmodules.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210828183859_PGAddUpdateSubmodules.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "UpdateSubmodules", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "UpdateSubmodules", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20210828183954_SLAddUpdateSubmodules.cs b/src/Tgstation.Server.Host/Database/Migrations/20210828183954_SLAddUpdateSubmodules.cs index ece3953b03..94b4b3686c 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20210828183954_SLAddUpdateSubmodules.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20210828183954_SLAddUpdateSubmodules.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "UpdateSubmodules", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "RepositorySettings", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20220811162903_MSAddDumpOnHeartbeatRestart.cs b/src/Tgstation.Server.Host/Database/Migrations/20220811162903_MSAddDumpOnHeartbeatRestart.cs index 380341f83e..4f064499c7 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20220811162903_MSAddDumpOnHeartbeatRestart.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20220811162903_MSAddDumpOnHeartbeatRestart.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "DumpOnHeartbeatRestart", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "DumpOnHeartbeatRestart", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20220811163039_MYAddDumpOnHeartbeatRestart.cs b/src/Tgstation.Server.Host/Database/Migrations/20220811163039_MYAddDumpOnHeartbeatRestart.cs index 25126ae36a..a408d7a7d8 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20220811163039_MYAddDumpOnHeartbeatRestart.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20220811163039_MYAddDumpOnHeartbeatRestart.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "DumpOnHeartbeatRestart", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "DumpOnHeartbeatRestart", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20220811163234_PGAddDumpOnHeartbeatRestart.cs b/src/Tgstation.Server.Host/Database/Migrations/20220811163234_PGAddDumpOnHeartbeatRestart.cs index cdc490be38..5b51a00926 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20220811163234_PGAddDumpOnHeartbeatRestart.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20220811163234_PGAddDumpOnHeartbeatRestart.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "DumpOnHeartbeatRestart", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "DumpOnHeartbeatRestart", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20220811163432_SLAddDumpOnHeartbeatRestart.cs b/src/Tgstation.Server.Host/Database/Migrations/20220811163432_SLAddDumpOnHeartbeatRestart.cs index c377674b97..7ac6374b0b 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20220811163432_SLAddDumpOnHeartbeatRestart.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20220811163432_SLAddDumpOnHeartbeatRestart.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "DumpOnHeartbeatRestart", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "DreamDaemonSettings", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20220814142133_MSAddProfiler.cs b/src/Tgstation.Server.Host/Database/Migrations/20220814142133_MSAddProfiler.cs index 4966baafc8..9be7b91bc5 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20220814142133_MSAddProfiler.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20220814142133_MSAddProfiler.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "StartProfiler", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "StartProfiler", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20220814142253_MYAddProfiler.cs b/src/Tgstation.Server.Host/Database/Migrations/20220814142253_MYAddProfiler.cs index d339d81fd9..9686357f39 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20220814142253_MYAddProfiler.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20220814142253_MYAddProfiler.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "StartProfiler", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "StartProfiler", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20220814142401_PGAddProfiler.cs b/src/Tgstation.Server.Host/Database/Migrations/20220814142401_PGAddProfiler.cs index 46f7d413e5..92b779019b 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20220814142401_PGAddProfiler.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20220814142401_PGAddProfiler.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "StartProfiler", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "StartProfiler", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20220814142535_SLAddProfiler.cs b/src/Tgstation.Server.Host/Database/Migrations/20220814142535_SLAddProfiler.cs index 1eeae95163..816532b221 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20220814142535_SLAddProfiler.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20220814142535_SLAddProfiler.cs @@ -12,8 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "StartProfiler", @@ -25,8 +24,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.RenameTable( name: "DreamDaemonSettings", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230331220749_MSAddDreamDaemonLogOutput.cs b/src/Tgstation.Server.Host/Database/Migrations/20230331220749_MSAddDreamDaemonLogOutput.cs index 366ac06457..bc8e3d1880 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230331220749_MSAddDreamDaemonLogOutput.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230331220749_MSAddDreamDaemonLogOutput.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "LogOutput", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LogOutput", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230331221032_PGAddDreamDaemonLogOutput.cs b/src/Tgstation.Server.Host/Database/Migrations/20230331221032_PGAddDreamDaemonLogOutput.cs index 0998a70dcf..1828f867bb 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230331221032_PGAddDreamDaemonLogOutput.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230331221032_PGAddDreamDaemonLogOutput.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "LogOutput", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LogOutput", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230331221156_SLAddDreamDaemonLogOutput.cs b/src/Tgstation.Server.Host/Database/Migrations/20230331221156_SLAddDreamDaemonLogOutput.cs index 53b0c787aa..587dbf9aa2 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230331221156_SLAddDreamDaemonLogOutput.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230331221156_SLAddDreamDaemonLogOutput.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "LogOutput", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LogOutput", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230401210715_MYAddDreamDaemonLogOutput.cs b/src/Tgstation.Server.Host/Database/Migrations/20230401210715_MYAddDreamDaemonLogOutput.cs index 082ec52323..2b023f5fa2 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230401210715_MYAddDreamDaemonLogOutput.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230401210715_MYAddDreamDaemonLogOutput.cs @@ -15,8 +15,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "LogOutput", @@ -29,8 +28,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "LogOutput", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230403050623_MSAddReattachInfoInitialCompileJob.cs b/src/Tgstation.Server.Host/Database/Migrations/20230403050623_MSAddReattachInfoInitialCompileJob.cs index 085832fc0c..2c378335d7 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230403050623_MSAddReattachInfoInitialCompileJob.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230403050623_MSAddReattachInfoInitialCompileJob.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "InitialCompileJobId", @@ -39,8 +38,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ReattachInformations_CompileJobs_InitialCompileJobId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230403050737_MYAddReattachInfoInitialCompileJob.cs b/src/Tgstation.Server.Host/Database/Migrations/20230403050737_MYAddReattachInfoInitialCompileJob.cs index bf2a0b84d3..da962107e1 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230403050737_MYAddReattachInfoInitialCompileJob.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230403050737_MYAddReattachInfoInitialCompileJob.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "InitialCompileJobId", @@ -39,8 +38,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ReattachInformations_CompileJobs_InitialCompileJobId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230403050832_PGAddReattachInfoInitialCompileJob.cs b/src/Tgstation.Server.Host/Database/Migrations/20230403050832_PGAddReattachInfoInitialCompileJob.cs index 0f46df6c05..14d08913ec 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230403050832_PGAddReattachInfoInitialCompileJob.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230403050832_PGAddReattachInfoInitialCompileJob.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "InitialCompileJobId", @@ -39,8 +38,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ReattachInformations_CompileJobs_InitialCompileJobId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230403050941_SLAddReattachInfoInitialCompileJob.cs b/src/Tgstation.Server.Host/Database/Migrations/20230403050941_SLAddReattachInfoInitialCompileJob.cs index 1b06d44947..630411174d 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230403050941_SLAddReattachInfoInitialCompileJob.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230403050941_SLAddReattachInfoInitialCompileJob.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "InitialCompileJobId", @@ -39,8 +38,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropForeignKey( name: "FK_ReattachInformations_CompileJobs_InitialCompileJobId", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230520203236_MSAddSystemChannels.cs b/src/Tgstation.Server.Host/Database/Migrations/20230520203236_MSAddSystemChannels.cs index b2ead80c4d..410d150c1e 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230520203236_MSAddSystemChannels.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230520203236_MSAddSystemChannels.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "IsSystemChannel", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "IsSystemChannel", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230520203305_MYAddSystemChannels.cs b/src/Tgstation.Server.Host/Database/Migrations/20230520203305_MYAddSystemChannels.cs index 4204b4d848..ec249f3e44 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230520203305_MYAddSystemChannels.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230520203305_MYAddSystemChannels.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "IsSystemChannel", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "IsSystemChannel", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230520203332_PGAddSystemChannels.cs b/src/Tgstation.Server.Host/Database/Migrations/20230520203332_PGAddSystemChannels.cs index 7ea501e32a..60bf1c5229 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230520203332_PGAddSystemChannels.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230520203332_PGAddSystemChannels.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "IsSystemChannel", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "IsSystemChannel", diff --git a/src/Tgstation.Server.Host/Database/Migrations/20230520203402_SLAddSystemChannels.cs b/src/Tgstation.Server.Host/Database/Migrations/20230520203402_SLAddSystemChannels.cs index 118b606517..4dc47740e8 100644 --- a/src/Tgstation.Server.Host/Database/Migrations/20230520203402_SLAddSystemChannels.cs +++ b/src/Tgstation.Server.Host/Database/Migrations/20230520203402_SLAddSystemChannels.cs @@ -14,8 +14,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Up(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.AddColumn( name: "IsSystemChannel", @@ -28,8 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - if (migrationBuilder == null) - throw new ArgumentNullException(nameof(migrationBuilder)); + ArgumentNullException.ThrowIfNull(migrationBuilder); migrationBuilder.DropColumn( name: "IsSystemChannel", diff --git a/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs b/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs index fcb730fabe..d9d005a846 100644 --- a/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs @@ -33,10 +33,8 @@ namespace Tgstation.Server.Host.Database /// The . public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfiguration databaseConfiguration) { - if (options == null) - throw new ArgumentNullException(nameof(options)); - if (databaseConfiguration == null) - throw new ArgumentNullException(nameof(databaseConfiguration)); + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(databaseConfiguration); if (databaseConfiguration.DatabaseType != DatabaseType.MariaDB && databaseConfiguration.DatabaseType != DatabaseType.MySql) throw new InvalidOperationException($"Invalid DatabaseType for {nameof(MySqlDatabaseContext)}!"); diff --git a/src/Tgstation.Server.Host/Database/PostgresSqlDatabaseContext.cs b/src/Tgstation.Server.Host/Database/PostgresSqlDatabaseContext.cs index 0274d2e8b3..d9157ab41a 100644 --- a/src/Tgstation.Server.Host/Database/PostgresSqlDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/PostgresSqlDatabaseContext.cs @@ -31,10 +31,8 @@ namespace Tgstation.Server.Host.Database /// The . public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfiguration databaseConfiguration) { - if (options == null) - throw new ArgumentNullException(nameof(options)); - if (databaseConfiguration == null) - throw new ArgumentNullException(nameof(databaseConfiguration)); + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(databaseConfiguration); if (databaseConfiguration.DatabaseType != DatabaseType.PostgresSql) throw new InvalidOperationException($"Invalid DatabaseType for {nameof(PostgresSqlDatabaseContext)}!"); diff --git a/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs b/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs index 71dddb328d..c3d81f1321 100644 --- a/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs @@ -26,10 +26,8 @@ namespace Tgstation.Server.Host.Database /// The . public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfiguration databaseConfiguration) { - if (options == null) - throw new ArgumentNullException(nameof(options)); - if (databaseConfiguration == null) - throw new ArgumentNullException(nameof(databaseConfiguration)); + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(databaseConfiguration); if (databaseConfiguration.DatabaseType != DatabaseType.SqlServer) throw new InvalidOperationException($"Invalid DatabaseType for {nameof(SqlServerDatabaseContext)}!"); diff --git a/src/Tgstation.Server.Host/Database/SqliteDatabaseContext.cs b/src/Tgstation.Server.Host/Database/SqliteDatabaseContext.cs index 3aa0955d79..0076efe2c2 100644 --- a/src/Tgstation.Server.Host/Database/SqliteDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/SqliteDatabaseContext.cs @@ -33,10 +33,8 @@ namespace Tgstation.Server.Host.Database /// The . public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfiguration databaseConfiguration) { - if (options == null) - throw new ArgumentNullException(nameof(options)); - if (databaseConfiguration == null) - throw new ArgumentNullException(nameof(databaseConfiguration)); + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(databaseConfiguration); if (databaseConfiguration.DatabaseType != DatabaseType.Sqlite) throw new InvalidOperationException($"Invalid DatabaseType for {nameof(SqliteDatabaseContext)}!"); diff --git a/src/Tgstation.Server.Host/Extensions/ApplicationBuilderExtensions.cs b/src/Tgstation.Server.Host/Extensions/ApplicationBuilderExtensions.cs index 807cca74f3..42bb3ad8fb 100644 --- a/src/Tgstation.Server.Host/Extensions/ApplicationBuilderExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/ApplicationBuilderExtensions.cs @@ -37,8 +37,7 @@ namespace Tgstation.Server.Host.Extensions /// The to configure. public static void UseDbConflictHandling(this IApplicationBuilder applicationBuilder) { - if (applicationBuilder == null) - throw new ArgumentNullException(nameof(applicationBuilder)); + ArgumentNullException.ThrowIfNull(applicationBuilder); applicationBuilder.Use(async (context, next) => { @@ -73,8 +72,7 @@ namespace Tgstation.Server.Host.Extensions /// The to configure. public static void UseDisabledClientCache(this IApplicationBuilder applicationBuilder) { - if (applicationBuilder == null) - throw new ArgumentNullException(nameof(applicationBuilder)); + ArgumentNullException.ThrowIfNull(applicationBuilder); applicationBuilder.Use(async (context, next) => { context.Response.Headers.Add(HeaderNames.CacheControl, new StringValues("no-cache")); @@ -88,8 +86,7 @@ namespace Tgstation.Server.Host.Extensions /// The to configure. public static void UseCancelledRequestSuppression(this IApplicationBuilder applicationBuilder) { - if (applicationBuilder == null) - throw new ArgumentNullException(nameof(applicationBuilder)); + ArgumentNullException.ThrowIfNull(applicationBuilder); applicationBuilder.Use(async (context, next) => { var logger = GetLogger(context); @@ -110,8 +107,7 @@ namespace Tgstation.Server.Host.Extensions /// The to configure. public static void UseServerErrorHandling(this IApplicationBuilder applicationBuilder) { - if (applicationBuilder == null) - throw new ArgumentNullException(nameof(applicationBuilder)); + ArgumentNullException.ThrowIfNull(applicationBuilder); applicationBuilder.Use(async (context, next) => { @@ -146,10 +142,8 @@ namespace Tgstation.Server.Host.Extensions /// The to use. public static void UseServerBranding(this IApplicationBuilder applicationBuilder, IAssemblyInformationProvider assemblyInformationProvider) { - if (applicationBuilder == null) - throw new ArgumentNullException(nameof(applicationBuilder)); - if (assemblyInformationProvider == null) - throw new ArgumentNullException(nameof(assemblyInformationProvider)); + ArgumentNullException.ThrowIfNull(applicationBuilder); + ArgumentNullException.ThrowIfNull(assemblyInformationProvider); applicationBuilder.Use(async (context, next) => { @@ -165,10 +159,8 @@ namespace Tgstation.Server.Host.Extensions /// The . public static void UseAdditionalRequestLoggingContext(this IApplicationBuilder applicationBuilder, SwarmConfiguration swarmConfiguration) { - if (applicationBuilder == null) - throw new ArgumentNullException(nameof(applicationBuilder)); - if (swarmConfiguration == null) - throw new ArgumentNullException(nameof(swarmConfiguration)); + ArgumentNullException.ThrowIfNull(applicationBuilder); + ArgumentNullException.ThrowIfNull(swarmConfiguration); if (LogSwarmIdentifier && swarmConfiguration.Identifier != null) applicationBuilder.Use(async (context, next) => diff --git a/src/Tgstation.Server.Host/Extensions/ChatChannelExtensions.cs b/src/Tgstation.Server.Host/Extensions/ChatChannelExtensions.cs index 5a3fd8ac26..edfb7bb426 100644 --- a/src/Tgstation.Server.Host/Extensions/ChatChannelExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/ChatChannelExtensions.cs @@ -38,8 +38,7 @@ namespace Tgstation.Server.Host.Extensions /// A of the 's separated by the ':' . static IReadOnlyCollection GetIrcChannelSplits(ChatChannel chatChannel) { - if (chatChannel == null) - throw new ArgumentNullException(nameof(chatChannel)); + ArgumentNullException.ThrowIfNull(chatChannel); if (chatChannel.IrcChannel == null) throw new ArgumentException("IrcChannel must be set!", nameof(chatChannel)); diff --git a/src/Tgstation.Server.Host/Extensions/Converters/VersionConverter.cs b/src/Tgstation.Server.Host/Extensions/Converters/VersionConverter.cs index 119414f2af..83eee22114 100644 --- a/src/Tgstation.Server.Host/Extensions/Converters/VersionConverter.cs +++ b/src/Tgstation.Server.Host/Extensions/Converters/VersionConverter.cs @@ -23,8 +23,7 @@ namespace Tgstation.Server.Host.Extensions.Converters /// if is a , otherwise. static bool CheckSupportsType(Type type, bool validate) { - if (type == null) - throw new ArgumentNullException(nameof(type)); + ArgumentNullException.ThrowIfNull(type); var supported = type == typeof(global::System.Version); if (!supported && validate) @@ -53,8 +52,7 @@ namespace Tgstation.Server.Host.Extensions.Converters /// public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - if (reader == null) - throw new ArgumentNullException(nameof(reader)); + ArgumentNullException.ThrowIfNull(reader); CheckSupportsType(objectType, true); @@ -90,8 +88,7 @@ namespace Tgstation.Server.Host.Extensions.Converters /// public void WriteYaml(IEmitter emitter, object value, Type type) { - if (emitter == null) - throw new ArgumentNullException(nameof(emitter)); + ArgumentNullException.ThrowIfNull(emitter); CheckSupportsType(type, true); diff --git a/src/Tgstation.Server.Host/Extensions/FileTransferStreamHandlerExtensions.cs b/src/Tgstation.Server.Host/Extensions/FileTransferStreamHandlerExtensions.cs index e07c0aa0fc..83cd739213 100644 --- a/src/Tgstation.Server.Host/Extensions/FileTransferStreamHandlerExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/FileTransferStreamHandlerExtensions.cs @@ -35,11 +35,9 @@ namespace Tgstation.Server.Host.Extensions string ticket, CancellationToken cancellationToken) { - if (fileTransferService == null) - throw new ArgumentNullException(nameof(fileTransferService)); + ArgumentNullException.ThrowIfNull(fileTransferService); - if (controller == null) - throw new ArgumentNullException(nameof(controller)); + ArgumentNullException.ThrowIfNull(controller); if (ticket == null) return controller.BadRequest(new ErrorMessageResponse(ErrorCode.ModelValidationFailure)); diff --git a/src/Tgstation.Server.Host/Extensions/GeneralConfigurationExtensions.cs b/src/Tgstation.Server.Host/Extensions/GeneralConfigurationExtensions.cs index 9a8418fde4..0a2a5fc8d8 100644 --- a/src/Tgstation.Server.Host/Extensions/GeneralConfigurationExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/GeneralConfigurationExtensions.cs @@ -16,8 +16,7 @@ namespace Tgstation.Server.Host.Extensions /// The total number of tasks that may run simultaneously during an asynchronous directory copy operation. public static int? GetCopyDirectoryTaskThrottle(this GeneralConfiguration generalConfiguration) { - if (generalConfiguration == null) - throw new ArgumentNullException(nameof(generalConfiguration)); + ArgumentNullException.ThrowIfNull(generalConfiguration); var tasksPerCore = generalConfiguration.DeploymentDirectoryCopyTasksPerCore; if (!tasksPerCore.HasValue) diff --git a/src/Tgstation.Server.Host/Extensions/HostBuilderExtensions.cs b/src/Tgstation.Server.Host/Extensions/HostBuilderExtensions.cs index 0b4e6a5aa3..6bfc4cb528 100644 --- a/src/Tgstation.Server.Host/Extensions/HostBuilderExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/HostBuilderExtensions.cs @@ -25,8 +25,7 @@ namespace Tgstation.Server.Host.Extensions IAssemblyInformationProvider assemblyInformationProvider, IIOManager ioManager) { - if (builder == null) - throw new ArgumentNullException(nameof(builder)); + ArgumentNullException.ThrowIfNull(builder); return builder.ConfigureServices((context, services) => { diff --git a/src/Tgstation.Server.Host/Extensions/ResultExtensions.cs b/src/Tgstation.Server.Host/Extensions/ResultExtensions.cs index e91128f515..5d4370734f 100644 --- a/src/Tgstation.Server.Host/Extensions/ResultExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/ResultExtensions.cs @@ -22,8 +22,7 @@ namespace Tgstation.Server.Host.Extensions /// The formatted . public static string LogFormat(this IResult result, uint level = 0) { - if (result == null) - throw new ArgumentNullException(nameof(result)); + ArgumentNullException.ThrowIfNull(result); if (result.IsSuccess) return "SUCCESS?"; diff --git a/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs b/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs index 49087b4a50..d3f70f6a28 100644 --- a/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs @@ -87,8 +87,7 @@ namespace Tgstation.Server.Host.Extensions /// . public static IServiceCollection AddFileDownloader(this IServiceCollection serviceCollection) { - if (serviceCollection == null) - throw new ArgumentNullException(nameof(serviceCollection)); + ArgumentNullException.ThrowIfNull(serviceCollection); serviceCollection.AddSingleton(typeof(IFileDownloader), fileDownloaderType); @@ -102,8 +101,7 @@ namespace Tgstation.Server.Host.Extensions /// . public static IServiceCollection AddGitHub(this IServiceCollection serviceCollection) { - if (serviceCollection == null) - throw new ArgumentNullException(nameof(serviceCollection)); + ArgumentNullException.ThrowIfNull(serviceCollection); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(typeof(IGitHubServiceFactory), gitHubServiceFactoryType); @@ -130,8 +128,7 @@ namespace Tgstation.Server.Host.Extensions /// . public static IServiceCollection AddChatProviderFactory(this IServiceCollection serviceCollection) { - if (serviceCollection == null) - throw new ArgumentNullException(nameof(serviceCollection)); + ArgumentNullException.ThrowIfNull(serviceCollection); return serviceCollection.AddSingleton(typeof(IProviderFactory), chatProviderFactoryType); } @@ -145,10 +142,8 @@ namespace Tgstation.Server.Host.Extensions /// . public static IServiceCollection UseStandardConfig(this IServiceCollection serviceCollection, IConfiguration configuration) where TConfig : class { - if (serviceCollection == null) - throw new ArgumentNullException(nameof(serviceCollection)); - if (configuration == null) - throw new ArgumentNullException(nameof(configuration)); + ArgumentNullException.ThrowIfNull(serviceCollection); + ArgumentNullException.ThrowIfNull(configuration); const string SectionFieldName = nameof(GeneralConfiguration.Section); diff --git a/src/Tgstation.Server.Host/Extensions/TaskExtensions.cs b/src/Tgstation.Server.Host/Extensions/TaskExtensions.cs index bd65a629d9..48644e0cd5 100644 --- a/src/Tgstation.Server.Host/Extensions/TaskExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/TaskExtensions.cs @@ -27,8 +27,7 @@ namespace Tgstation.Server.Host.Extensions /// A representing the running operation. public static Task WithToken(this Task task, CancellationToken cancellationToken) { - if (task == null) - throw new ArgumentNullException(nameof(task)); + ArgumentNullException.ThrowIfNull(task); async Task Wrap() { @@ -48,8 +47,7 @@ namespace Tgstation.Server.Host.Extensions /// A resulting in the result of . public static async Task WithToken(this Task task, CancellationToken cancellationToken) { - if (task == null) - throw new ArgumentNullException(nameof(task)); + ArgumentNullException.ThrowIfNull(task); var cancelTcs = new TaskCompletionSource(); using (cancellationToken.Register(() => cancelTcs.SetCanceled())) diff --git a/src/Tgstation.Server.Host/Extensions/WebHostBuilderExtensions.cs b/src/Tgstation.Server.Host/Extensions/WebHostBuilderExtensions.cs index e7b82e192a..e6815cd7a0 100644 --- a/src/Tgstation.Server.Host/Extensions/WebHostBuilderExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/WebHostBuilderExtensions.cs @@ -34,14 +34,10 @@ namespace Tgstation.Server.Host.Extensions IIOManager ioManager, IPostSetupServices postSetupServices) { - if (builder == null) - throw new ArgumentNullException(nameof(builder)); - if (assemblyInformationProvider == null) - throw new ArgumentNullException(nameof(assemblyInformationProvider)); - if (ioManager == null) - throw new ArgumentNullException(nameof(ioManager)); - if (postSetupServices == null) - throw new ArgumentNullException(nameof(postSetupServices)); + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(assemblyInformationProvider); + ArgumentNullException.ThrowIfNull(ioManager); + ArgumentNullException.ThrowIfNull(postSetupServices); return builder.ConfigureServices( (context, services) => diff --git a/src/Tgstation.Server.Host/IO/DefaultIOManager.cs b/src/Tgstation.Server.Host/IO/DefaultIOManager.cs index a253addc93..508f0ace4a 100644 --- a/src/Tgstation.Server.Host/IO/DefaultIOManager.cs +++ b/src/Tgstation.Server.Host/IO/DefaultIOManager.cs @@ -76,10 +76,8 @@ namespace Tgstation.Server.Host.IO int? taskThrottle, CancellationToken cancellationToken) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dest == null) - throw new ArgumentNullException(nameof(src)); + ArgumentNullException.ThrowIfNull(src); + ArgumentNullException.ThrowIfNull(src); if (taskThrottle.HasValue && taskThrottle < 1) throw new ArgumentOutOfRangeException(nameof(taskThrottle), taskThrottle, "taskThrottle must be at least 1!"); @@ -97,10 +95,8 @@ namespace Tgstation.Server.Host.IO /// public async Task CopyFile(string src, string dest, CancellationToken cancellationToken) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dest == null) - throw new ArgumentNullException(nameof(dest)); + ArgumentNullException.ThrowIfNull(src); + ArgumentNullException.ThrowIfNull(dest); // tested to hell and back, these are the optimal buffer sizes await using var srcStream = new FileStream( @@ -179,8 +175,7 @@ namespace Tgstation.Server.Host.IO public Task MoveFile(string source, string destination, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (destination == null) - throw new ArgumentNullException(nameof(destination)); + ArgumentNullException.ThrowIfNull(destination); source = ResolvePath(source ?? throw new ArgumentNullException(nameof(source))); destination = ResolvePath(destination); File.Move(source, destination); @@ -193,8 +188,7 @@ namespace Tgstation.Server.Host.IO public Task MoveDirectory(string source, string destination, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (destination == null) - throw new ArgumentNullException(nameof(destination)); + ArgumentNullException.ThrowIfNull(destination); source = ResolvePath(source ?? throw new ArgumentNullException(nameof(source))); destination = ResolvePath(destination); Directory.Move(source, destination); @@ -289,8 +283,7 @@ namespace Tgstation.Server.Host.IO () => { path = ResolvePath(path); - if (zipFile == null) - throw new ArgumentNullException(nameof(zipFile)); + ArgumentNullException.ThrowIfNull(zipFile); #if NET7_0_OR_GREATER #warning Check if zip file seeking has been addressesed. See https://github.com/tgstation/tgstation-server/issues/1531 diff --git a/src/Tgstation.Server.Host/IO/FileDownloader.cs b/src/Tgstation.Server.Host/IO/FileDownloader.cs index 6def59dd4f..1aa554e647 100644 --- a/src/Tgstation.Server.Host/IO/FileDownloader.cs +++ b/src/Tgstation.Server.Host/IO/FileDownloader.cs @@ -36,8 +36,7 @@ namespace Tgstation.Server.Host.IO /// public IFileStreamProvider DownloadFile(Uri url, string bearerToken) { - if (url == null) - throw new ArgumentNullException(nameof(url)); + ArgumentNullException.ThrowIfNull(url); logger.LogDebug("Starting download of {url}...", url); var httpClient = httpClientFactory.CreateClient(); diff --git a/src/Tgstation.Server.Host/IO/PosixPostWriteHandler.cs b/src/Tgstation.Server.Host/IO/PosixPostWriteHandler.cs index a69f77ac74..a0f4f5a4c8 100644 --- a/src/Tgstation.Server.Host/IO/PosixPostWriteHandler.cs +++ b/src/Tgstation.Server.Host/IO/PosixPostWriteHandler.cs @@ -28,8 +28,7 @@ namespace Tgstation.Server.Host.IO /// public bool NeedsPostWrite(string sourceFilePath) { - if (sourceFilePath == null) - throw new ArgumentNullException(nameof(sourceFilePath)); + ArgumentNullException.ThrowIfNull(sourceFilePath); if (Syscall.stat(sourceFilePath, out var stat) != 0) throw new UnixIOException(Stdlib.GetLastError()); @@ -40,8 +39,7 @@ namespace Tgstation.Server.Host.IO /// public void HandleWrite(string filePath) { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); + ArgumentNullException.ThrowIfNull(filePath); // set executable bit every time, don't want people calling me when their uploaded "sl" binary doesn't work if (Syscall.stat(filePath, out var stat) != 0) diff --git a/src/Tgstation.Server.Host/IO/PosixSymlinkFactory.cs b/src/Tgstation.Server.Host/IO/PosixSymlinkFactory.cs index 4644080a10..0ba66a3cd6 100644 --- a/src/Tgstation.Server.Host/IO/PosixSymlinkFactory.cs +++ b/src/Tgstation.Server.Host/IO/PosixSymlinkFactory.cs @@ -16,10 +16,8 @@ namespace Tgstation.Server.Host.IO public Task CreateSymbolicLink(string targetPath, string linkPath, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (targetPath == null) - throw new ArgumentNullException(nameof(targetPath)); - if (linkPath == null) - throw new ArgumentNullException(nameof(linkPath)); + ArgumentNullException.ThrowIfNull(targetPath); + ArgumentNullException.ThrowIfNull(linkPath); UnixFileSystemInfo fsInfo; var isFile = File.Exists(targetPath); diff --git a/src/Tgstation.Server.Host/IO/ResolvingIOManager.cs b/src/Tgstation.Server.Host/IO/ResolvingIOManager.cs index 0bb4a879ed..3b86b92c36 100644 --- a/src/Tgstation.Server.Host/IO/ResolvingIOManager.cs +++ b/src/Tgstation.Server.Host/IO/ResolvingIOManager.cs @@ -20,10 +20,8 @@ namespace Tgstation.Server.Host.IO /// The value of . public ResolvingIOManager(IIOManager parent, string subdirectory) { - if (parent == null) - throw new ArgumentNullException(nameof(parent)); - if (subdirectory == null) - throw new ArgumentNullException(nameof(subdirectory)); + ArgumentNullException.ThrowIfNull(parent); + ArgumentNullException.ThrowIfNull(subdirectory); this.subdirectory = ConcatPath(parent.ResolvePath(), subdirectory); } diff --git a/src/Tgstation.Server.Host/IO/SynchronousIOManager.cs b/src/Tgstation.Server.Host/IO/SynchronousIOManager.cs index f6ebae6c51..a629ddcff4 100644 --- a/src/Tgstation.Server.Host/IO/SynchronousIOManager.cs +++ b/src/Tgstation.Server.Host/IO/SynchronousIOManager.cs @@ -60,26 +60,22 @@ namespace Tgstation.Server.Host.IO /// public bool IsDirectory(string path) { - if (path == null) - throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(path); return Directory.Exists(path); } /// public byte[] ReadFile(string path) { - if (path == null) - throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(path); return File.ReadAllBytes(path); } /// public bool WriteFileChecked(string path, Stream data, ref string sha1InOut, CancellationToken cancellationToken) { - if (path == null) - throw new ArgumentNullException(nameof(path)); - if (data == null) - throw new ArgumentNullException(nameof(data)); + ArgumentNullException.ThrowIfNull(path); + ArgumentNullException.ThrowIfNull(data); cancellationToken.ThrowIfCancellationRequested(); var directory = Path.GetDirectoryName(path); diff --git a/src/Tgstation.Server.Host/IO/WindowsPostWriteHandler.cs b/src/Tgstation.Server.Host/IO/WindowsPostWriteHandler.cs index 76c4b0f9c6..2a94e42a2f 100644 --- a/src/Tgstation.Server.Host/IO/WindowsPostWriteHandler.cs +++ b/src/Tgstation.Server.Host/IO/WindowsPostWriteHandler.cs @@ -10,8 +10,7 @@ namespace Tgstation.Server.Host.IO /// public bool NeedsPostWrite(string sourceFilePath) { - if (sourceFilePath == null) - throw new ArgumentNullException(nameof(sourceFilePath)); + ArgumentNullException.ThrowIfNull(sourceFilePath); return false; } @@ -19,8 +18,7 @@ namespace Tgstation.Server.Host.IO /// public void HandleWrite(string filePath) { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); + ArgumentNullException.ThrowIfNull(filePath); } } } diff --git a/src/Tgstation.Server.Host/IO/WindowsSymlinkFactory.cs b/src/Tgstation.Server.Host/IO/WindowsSymlinkFactory.cs index 2beddb0581..e11306dc27 100644 --- a/src/Tgstation.Server.Host/IO/WindowsSymlinkFactory.cs +++ b/src/Tgstation.Server.Host/IO/WindowsSymlinkFactory.cs @@ -17,10 +17,8 @@ namespace Tgstation.Server.Host.IO public Task CreateSymbolicLink(string targetPath, string linkPath, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (targetPath == null) - throw new ArgumentNullException(nameof(targetPath)); - if (linkPath == null) - throw new ArgumentNullException(nameof(linkPath)); + ArgumentNullException.ThrowIfNull(targetPath); + ArgumentNullException.ThrowIfNull(linkPath); // check if its not a file var flags = File.Exists(targetPath) ? NativeMethods.CreateSymbolicLinkFlags.None : NativeMethods.CreateSymbolicLinkFlags.Directory; diff --git a/src/Tgstation.Server.Host/Jobs/JobService.cs b/src/Tgstation.Server.Host/Jobs/JobService.cs index efa0b09137..2a186fb2ae 100644 --- a/src/Tgstation.Server.Host/Jobs/JobService.cs +++ b/src/Tgstation.Server.Host/Jobs/JobService.cs @@ -91,10 +91,8 @@ namespace Tgstation.Server.Host.Jobs => databaseContextFactory.UseContext( async databaseContext => { - if (job == null) - throw new ArgumentNullException(nameof(job)); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); + ArgumentNullException.ThrowIfNull(job); + ArgumentNullException.ThrowIfNull(operation); job.StartedAt = DateTimeOffset.UtcNow; job.Cancelled = false; @@ -197,8 +195,7 @@ namespace Tgstation.Server.Host.Jobs /// public async Task CancelJob(Job job, User user, bool blocking, CancellationToken cancellationToken) { - if (job == null) - throw new ArgumentNullException(nameof(job)); + ArgumentNullException.ThrowIfNull(job); JobHandler handler; lock (addCancelLock) @@ -239,8 +236,7 @@ namespace Tgstation.Server.Host.Jobs /// public void SetJobProgress(JobResponse apiResponse) { - if (apiResponse == null) - throw new ArgumentNullException(nameof(apiResponse)); + ArgumentNullException.ThrowIfNull(apiResponse); lock (synchronizationLock) { if (!jobs.TryGetValue(apiResponse.Id.Value, out var handler)) @@ -253,8 +249,7 @@ namespace Tgstation.Server.Host.Jobs /// public async Task WaitForJobCompletion(Job job, User canceller, CancellationToken jobCancellationToken, CancellationToken cancellationToken) { - if (job == null) - throw new ArgumentNullException(nameof(job)); + ArgumentNullException.ThrowIfNull(job); if (!cancellationToken.CanBeCanceled) throw new ArgumentException("A cancellable CancellationToken should be provided!", nameof(cancellationToken)); @@ -283,8 +278,7 @@ namespace Tgstation.Server.Host.Jobs /// public void Activate(IInstanceCoreProvider instanceCoreProvider) { - if (instanceCoreProvider == null) - throw new ArgumentNullException(nameof(instanceCoreProvider)); + ArgumentNullException.ThrowIfNull(instanceCoreProvider); logger.LogTrace("Activating job manager..."); activationTcs.SetResult(instanceCoreProvider); diff --git a/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs b/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs index 751360a385..76dfbfda36 100644 --- a/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs +++ b/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs @@ -53,8 +53,7 @@ namespace Tgstation.Server.Host.Models /// The to copy values from. protected ReattachInformationBase(ReattachInformationBase copy) { - if (copy == null) - throw new ArgumentNullException(nameof(copy)); + ArgumentNullException.ThrowIfNull(copy); AccessIdentifier = copy.AccessIdentifier; Port = copy.Port; ProcessId = copy.ProcessId; diff --git a/src/Tgstation.Server.Host/Security/ClaimsInjector.cs b/src/Tgstation.Server.Host/Security/ClaimsInjector.cs index de5dacc66e..a441af0f16 100644 --- a/src/Tgstation.Server.Host/Security/ClaimsInjector.cs +++ b/src/Tgstation.Server.Host/Security/ClaimsInjector.cs @@ -34,8 +34,7 @@ namespace Tgstation.Server.Host.Security /// public async Task InjectClaimsIntoContext(TokenValidatedContext tokenValidatedContext, CancellationToken cancellationToken) { - if (tokenValidatedContext == null) - throw new ArgumentNullException(nameof(tokenValidatedContext)); + ArgumentNullException.ThrowIfNull(tokenValidatedContext); // Find the user id in the token var userIdClaim = tokenValidatedContext.Principal.FindFirst(JwtRegisteredClaimNames.Sub); diff --git a/src/Tgstation.Server.Host/Security/CryptographySuite.cs b/src/Tgstation.Server.Host/Security/CryptographySuite.cs index 21051e2163..d98e61c303 100644 --- a/src/Tgstation.Server.Host/Security/CryptographySuite.cs +++ b/src/Tgstation.Server.Host/Security/CryptographySuite.cs @@ -42,10 +42,8 @@ namespace Tgstation.Server.Host.Security /// public void SetUserPassword(User user, string newPassword, bool newUser) { - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (newPassword == null) - throw new ArgumentNullException(nameof(newPassword)); + ArgumentNullException.ThrowIfNull(user); + ArgumentNullException.ThrowIfNull(newPassword); user.PasswordHash = passwordHasher.HashPassword(user, newPassword); if (!newUser) user.LastPasswordUpdate = DateTimeOffset.UtcNow; @@ -54,10 +52,8 @@ namespace Tgstation.Server.Host.Security /// public bool CheckUserPassword(User user, string password) { - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (password == null) - throw new ArgumentNullException(nameof(password)); + ArgumentNullException.ThrowIfNull(user); + ArgumentNullException.ThrowIfNull(password); var result = passwordHasher.VerifyHashedPassword(user, user.PasswordHash, password); switch (result) diff --git a/src/Tgstation.Server.Host/Security/IdentityCache.cs b/src/Tgstation.Server.Host/Security/IdentityCache.cs index 74eb439f56..8e59a0210b 100644 --- a/src/Tgstation.Server.Host/Security/IdentityCache.cs +++ b/src/Tgstation.Server.Host/Security/IdentityCache.cs @@ -51,10 +51,8 @@ namespace Tgstation.Server.Host.Security /// public void CacheSystemIdentity(User user, ISystemIdentity systemIdentity, DateTimeOffset expiry) { - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (systemIdentity == null) - throw new ArgumentNullException(nameof(systemIdentity)); + ArgumentNullException.ThrowIfNull(user); + ArgumentNullException.ThrowIfNull(systemIdentity); lock (cachedIdentities) { @@ -84,8 +82,7 @@ namespace Tgstation.Server.Host.Security /// public ISystemIdentity LoadCachedIdentity(User user) { - if (user == null) - throw new ArgumentNullException(nameof(user)); + ArgumentNullException.ThrowIfNull(user); lock (cachedIdentities) if (cachedIdentities.TryGetValue(user.Id.Value, out var identity)) return identity.SystemIdentity.Clone(); diff --git a/src/Tgstation.Server.Host/Security/IdentityCacheObject.cs b/src/Tgstation.Server.Host/Security/IdentityCacheObject.cs index 35a576a18a..7cc10664e5 100644 --- a/src/Tgstation.Server.Host/Security/IdentityCacheObject.cs +++ b/src/Tgstation.Server.Host/Security/IdentityCacheObject.cs @@ -37,11 +37,9 @@ namespace Tgstation.Server.Host.Security { SystemIdentity = systemIdentity ?? throw new ArgumentNullException(nameof(systemIdentity)); - if (asyncDelayer == null) - throw new ArgumentNullException(nameof(asyncDelayer)); + ArgumentNullException.ThrowIfNull(asyncDelayer); - if (onExpiry == null) - throw new ArgumentNullException(nameof(onExpiry)); + ArgumentNullException.ThrowIfNull(onExpiry); var now = DateTimeOffset.UtcNow; if (expiry < now) throw new ArgumentOutOfRangeException(nameof(expiry), expiry, "expiry must be greater than DateTimeOffset.UtcNow!"); diff --git a/src/Tgstation.Server.Host/Security/OAuth/GitHubOAuthValidator.cs b/src/Tgstation.Server.Host/Security/OAuth/GitHubOAuthValidator.cs index 520baf0484..ae19b252ca 100644 --- a/src/Tgstation.Server.Host/Security/OAuth/GitHubOAuthValidator.cs +++ b/src/Tgstation.Server.Host/Security/OAuth/GitHubOAuthValidator.cs @@ -54,8 +54,7 @@ namespace Tgstation.Server.Host.Security.OAuth /// public async Task ValidateResponseCode(string code, CancellationToken cancellationToken) { - if (code == null) - throw new ArgumentNullException(nameof(code)); + ArgumentNullException.ThrowIfNull(code); try { diff --git a/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs b/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs index 97e5e61141..05458a4c07 100644 --- a/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs +++ b/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs @@ -35,8 +35,7 @@ namespace Tgstation.Server.Host.Security.OAuth ILoggerFactory loggerFactory, IOptions securityConfigurationOptions) { - if (loggerFactory == null) - throw new ArgumentNullException(nameof(loggerFactory)); + ArgumentNullException.ThrowIfNull(loggerFactory); var securityConfiguration = securityConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(securityConfigurationOptions)); diff --git a/src/Tgstation.Server.Host/Security/TokenFactory.cs b/src/Tgstation.Server.Host/Security/TokenFactory.cs index bcca46c607..cbaf09b049 100644 --- a/src/Tgstation.Server.Host/Security/TokenFactory.cs +++ b/src/Tgstation.Server.Host/Security/TokenFactory.cs @@ -46,10 +46,8 @@ namespace Tgstation.Server.Host.Security { this.asyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer)); - if (cryptographySuite == null) - throw new ArgumentNullException(nameof(cryptographySuite)); - if (assemblyInformationProvider == null) - throw new ArgumentNullException(nameof(assemblyInformationProvider)); + ArgumentNullException.ThrowIfNull(cryptographySuite); + ArgumentNullException.ThrowIfNull(assemblyInformationProvider); securityConfiguration = securityConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(securityConfigurationOptions)); @@ -80,8 +78,7 @@ namespace Tgstation.Server.Host.Security /// public async Task CreateToken(Models.User user, bool oAuth, CancellationToken cancellationToken) { - if (user == null) - throw new ArgumentNullException(nameof(user)); + ArgumentNullException.ThrowIfNull(user); var now = DateTimeOffset.UtcNow; var nowUnix = now.ToUnixTimeSeconds(); diff --git a/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs b/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs index 0d48cc62fc..28b6bbcec7 100644 --- a/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs +++ b/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs @@ -90,8 +90,7 @@ namespace Tgstation.Server.Host.Security public Task RunImpersonated(Action action, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (action == null) - throw new ArgumentNullException(nameof(action)); + ArgumentNullException.ThrowIfNull(action); if (identity == null) throw new InvalidOperationException("Impersonate using a UserPrincipal based WindowsSystemIdentity!"); WindowsIdentity.RunImpersonated(identity.AccessToken, action); diff --git a/src/Tgstation.Server.Host/Security/WindowsSystemIdentityFactory.cs b/src/Tgstation.Server.Host/Security/WindowsSystemIdentityFactory.cs index 47ec0f3e3d..b677a56413 100644 --- a/src/Tgstation.Server.Host/Security/WindowsSystemIdentityFactory.cs +++ b/src/Tgstation.Server.Host/Security/WindowsSystemIdentityFactory.cs @@ -54,8 +54,7 @@ namespace Tgstation.Server.Host.Security public Task CreateSystemIdentity(User user, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (user == null) - throw new ArgumentNullException(nameof(user)); + ArgumentNullException.ThrowIfNull(user); if (user.SystemIdentifier == null) throw new InvalidOperationException("User's SystemIdentifier must not be null!"); @@ -111,10 +110,8 @@ namespace Tgstation.Server.Host.Security public Task CreateSystemIdentity(string username, string password, CancellationToken cancellationToken) => Task.Factory.StartNew( () => { - if (username == null) - throw new ArgumentNullException(nameof(username)); - if (password == null) - throw new ArgumentNullException(nameof(password)); + ArgumentNullException.ThrowIfNull(username); + ArgumentNullException.ThrowIfNull(password); var originalUsername = username; GetUserAndDomainName(originalUsername, out username, out var domainName); diff --git a/src/Tgstation.Server.Host/Server.cs b/src/Tgstation.Server.Host/Server.cs index de7a97cf65..6a26ed8440 100644 --- a/src/Tgstation.Server.Host/Server.cs +++ b/src/Tgstation.Server.Host/Server.cs @@ -164,10 +164,8 @@ namespace Tgstation.Server.Host /// public bool TryStartUpdate(IServerUpdateExecutor updateExecutor, Version newVersion) { - if (updateExecutor == null) - throw new ArgumentNullException(nameof(updateExecutor)); - if (newVersion == null) - throw new ArgumentNullException(nameof(newVersion)); + ArgumentNullException.ThrowIfNull(updateExecutor); + ArgumentNullException.ThrowIfNull(newVersion); CheckSanity(true); @@ -215,8 +213,7 @@ namespace Tgstation.Server.Host /// public IRestartRegistration RegisterForRestart(IRestartHandler handler) { - if (handler == null) - throw new ArgumentNullException(nameof(handler)); + ArgumentNullException.ThrowIfNull(handler); CheckSanity(false); diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index f0135b487c..01c1c752b2 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -46,8 +46,7 @@ namespace Tgstation.Server.Host #pragma warning disable CA1506 public async Task CreateServer(string[] args, string updatePath, CancellationToken cancellationToken) { - if (args == null) - throw new ArgumentNullException(nameof(args)); + ArgumentNullException.ThrowIfNull(args); var basePath = IOManager.ResolvePath(); IHostBuilder CreateDefaultBuilder() => Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) diff --git a/src/Tgstation.Server.Host/Setup/PostSetupServices.cs b/src/Tgstation.Server.Host/Setup/PostSetupServices.cs index 8c2fe9805f..808b2030d9 100644 --- a/src/Tgstation.Server.Host/Setup/PostSetupServices.cs +++ b/src/Tgstation.Server.Host/Setup/PostSetupServices.cs @@ -77,8 +77,7 @@ namespace Tgstation.Server.Host.Setup IOptions elasticsearchConfigurationOptions) { PlatformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier)); - if (loggerFactory == null) - throw new ArgumentNullException(nameof(loggerFactory)); + ArgumentNullException.ThrowIfNull(loggerFactory); Logger = loggerFactory.CreateLogger(); this.generalConfigurationOptions = generalConfigurationOptions ?? throw new ArgumentNullException(nameof(generalConfigurationOptions)); diff --git a/src/Tgstation.Server.Host/Setup/SetupApplication.cs b/src/Tgstation.Server.Host/Setup/SetupApplication.cs index 75c41b888d..4c85e43a60 100644 --- a/src/Tgstation.Server.Host/Setup/SetupApplication.cs +++ b/src/Tgstation.Server.Host/Setup/SetupApplication.cs @@ -41,12 +41,9 @@ namespace Tgstation.Server.Host.Setup /// The needed for configuration. public void ConfigureServices(IServiceCollection services, IAssemblyInformationProvider assemblyInformationProvider, IIOManager ioManager) { - if (services == null) - throw new ArgumentNullException(nameof(services)); - if (assemblyInformationProvider == null) - throw new ArgumentNullException(nameof(assemblyInformationProvider)); - if (ioManager == null) - throw new ArgumentNullException(nameof(ioManager)); + ArgumentNullException.ThrowIfNull(services); + ArgumentNullException.ThrowIfNull(assemblyInformationProvider); + ArgumentNullException.ThrowIfNull(ioManager); services.SetupLogging(config => config.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)); diff --git a/src/Tgstation.Server.Host/Setup/SetupWizard.cs b/src/Tgstation.Server.Host/Setup/SetupWizard.cs index c4633f0846..9db7a18063 100644 --- a/src/Tgstation.Server.Host/Setup/SetupWizard.cs +++ b/src/Tgstation.Server.Host/Setup/SetupWizard.cs @@ -116,8 +116,7 @@ namespace Tgstation.Server.Host.Setup this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier)); this.asyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer)); this.applicationLifetime = applicationLifetime ?? throw new ArgumentNullException(nameof(applicationLifetime)); - if (configuration == null) - throw new ArgumentNullException(nameof(configuration)); + ArgumentNullException.ThrowIfNull(configuration); generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions)); diff --git a/src/Tgstation.Server.Host/Swarm/SwarmService.cs b/src/Tgstation.Server.Host/Swarm/SwarmService.cs index ee1e28f5c8..952ffaba55 100644 --- a/src/Tgstation.Server.Host/Swarm/SwarmService.cs +++ b/src/Tgstation.Server.Host/Swarm/SwarmService.cs @@ -356,11 +356,9 @@ namespace Tgstation.Server.Host.Swarm /// public Task PrepareUpdate(ISeekableFileStreamProvider fileStreamProvider, Version version, CancellationToken cancellationToken) { - if (fileStreamProvider == null) - throw new ArgumentNullException(nameof(fileStreamProvider)); + ArgumentNullException.ThrowIfNull(fileStreamProvider); - if (version == null) - throw new ArgumentNullException(nameof(version)); + ArgumentNullException.ThrowIfNull(version); logger.LogTrace("Begin PrepareUpdate..."); return PrepareUpdateImpl( @@ -375,8 +373,7 @@ namespace Tgstation.Server.Host.Swarm /// public async Task PrepareUpdateFromController(SwarmUpdateRequest updateRequest, CancellationToken cancellationToken) { - if (updateRequest == null) - throw new ArgumentNullException(nameof(updateRequest)); + ArgumentNullException.ThrowIfNull(updateRequest); logger.LogInformation("Received remote update request from {nodeType}", !swarmController ? "controller" : "node"); var result = await PrepareUpdateImpl( @@ -502,8 +499,7 @@ namespace Tgstation.Server.Host.Swarm /// public void UpdateSwarmServersList(IEnumerable swarmServers) { - if (swarmServers == null) - throw new ArgumentNullException(nameof(swarmServers)); + ArgumentNullException.ThrowIfNull(swarmServers); if (swarmController) throw new InvalidOperationException("Cannot UpdateSwarmServersList on swarm controller!"); @@ -533,8 +529,7 @@ namespace Tgstation.Server.Host.Swarm /// public async Task RegisterNode(Api.Models.Internal.SwarmServer node, Guid registrationId, CancellationToken cancellationToken) { - if (node == null) - throw new ArgumentNullException(nameof(node)); + ArgumentNullException.ThrowIfNull(node); if (node.Identifier == null) throw new ArgumentException("Node missing Identifier!", nameof(node)); diff --git a/src/Tgstation.Server.Host/Swarm/SwarmUpdateOperation.cs b/src/Tgstation.Server.Host/Swarm/SwarmUpdateOperation.cs index 4e7232961b..01b9f28d18 100644 --- a/src/Tgstation.Server.Host/Swarm/SwarmUpdateOperation.cs +++ b/src/Tgstation.Server.Host/Swarm/SwarmUpdateOperation.cs @@ -107,8 +107,7 @@ namespace Tgstation.Server.Host.Swarm /// on success, if the update is aborting. public bool MarkNodeReady(string nodeIdentifier) { - if (nodeIdentifier == null) - throw new ArgumentNullException(nameof(nodeIdentifier)); + ArgumentNullException.ThrowIfNull(nodeIdentifier); if (nodesThatNeedToBeReadyToCommit == null) throw new InvalidOperationException("A non-controller node tried to mark a node as ready!"); diff --git a/src/Tgstation.Server.Host/System/PosixProcessFeatures.cs b/src/Tgstation.Server.Host/System/PosixProcessFeatures.cs index 184ce2b55e..d552b0b114 100644 --- a/src/Tgstation.Server.Host/System/PosixProcessFeatures.cs +++ b/src/Tgstation.Server.Host/System/PosixProcessFeatures.cs @@ -66,10 +66,8 @@ namespace Tgstation.Server.Host.System /// public async Task CreateDump(global::System.Diagnostics.Process process, string outputFile, CancellationToken cancellationToken) { - if (process == null) - throw new ArgumentNullException(nameof(process)); - if (outputFile == null) - throw new ArgumentNullException(nameof(outputFile)); + ArgumentNullException.ThrowIfNull(process); + ArgumentNullException.ThrowIfNull(outputFile); const string GCorePath = "/usr/bin/gcore"; if (!await ioManager.FileExists(GCorePath, cancellationToken)) diff --git a/src/Tgstation.Server.Host/System/Process.cs b/src/Tgstation.Server.Host/System/Process.cs index ea56d99d4e..16d97ec69e 100644 --- a/src/Tgstation.Server.Host/System/Process.cs +++ b/src/Tgstation.Server.Host/System/Process.cs @@ -212,8 +212,7 @@ namespace Tgstation.Server.Host.System /// public Task CreateDump(string outputFile, CancellationToken cancellationToken) { - if (outputFile == null) - throw new ArgumentNullException(nameof(outputFile)); + ArgumentNullException.ThrowIfNull(outputFile); logger.LogTrace("Dumping PID {pid} to {dumpFilePath}...", Id, outputFile); return processFeatures.CreateDump(handle, outputFile, cancellationToken); diff --git a/src/Tgstation.Server.Host/System/ProcessExecutor.cs b/src/Tgstation.Server.Host/System/ProcessExecutor.cs index ecd597528d..2ee26f2089 100644 --- a/src/Tgstation.Server.Host/System/ProcessExecutor.cs +++ b/src/Tgstation.Server.Host/System/ProcessExecutor.cs @@ -88,12 +88,9 @@ namespace Tgstation.Server.Host.System bool readStandardHandles, bool noShellExecute) { - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); - if (workingDirectory == null) - throw new ArgumentNullException(nameof(workingDirectory)); - if (arguments == null) - throw new ArgumentNullException(nameof(arguments)); + ArgumentNullException.ThrowIfNull(fileName); + ArgumentNullException.ThrowIfNull(workingDirectory); + ArgumentNullException.ThrowIfNull(arguments); if (!noShellExecute && readStandardHandles) throw new InvalidOperationException("Requesting output/error reading requires noShellExecute to be true!"); diff --git a/src/Tgstation.Server.Host/System/WindowsNetworkPromptReaper.cs b/src/Tgstation.Server.Host/System/WindowsNetworkPromptReaper.cs index dbf6db58b9..ce0fa3a88b 100644 --- a/src/Tgstation.Server.Host/System/WindowsNetworkPromptReaper.cs +++ b/src/Tgstation.Server.Host/System/WindowsNetworkPromptReaper.cs @@ -131,8 +131,7 @@ namespace Tgstation.Server.Host.System /// public void RegisterProcess(IProcess process) { - if (process == null) - throw new ArgumentNullException(nameof(process)); + ArgumentNullException.ThrowIfNull(process); lock (registeredProcesses) { diff --git a/src/Tgstation.Server.Host/System/WindowsProcessFeatures.cs b/src/Tgstation.Server.Host/System/WindowsProcessFeatures.cs index ea7d3e8f08..8aed17b22e 100644 --- a/src/Tgstation.Server.Host/System/WindowsProcessFeatures.cs +++ b/src/Tgstation.Server.Host/System/WindowsProcessFeatures.cs @@ -37,8 +37,7 @@ namespace Tgstation.Server.Host.System /// public void ResumeProcess(global::System.Diagnostics.Process process) { - if (process == null) - throw new ArgumentNullException(nameof(process)); + ArgumentNullException.ThrowIfNull(process); process.Refresh(); foreach (ProcessThread thread in process.Threads) @@ -67,8 +66,7 @@ namespace Tgstation.Server.Host.System /// public void SuspendProcess(global::System.Diagnostics.Process process) { - if (process == null) - throw new ArgumentNullException(nameof(process)); + ArgumentNullException.ThrowIfNull(process); process.Refresh(); foreach (ProcessThread thread in process.Threads) diff --git a/src/Tgstation.Server.Host/Transfer/FileTransferService.cs b/src/Tgstation.Server.Host/Transfer/FileTransferService.cs index bf3f2c44c6..0b7bdb497a 100644 --- a/src/Tgstation.Server.Host/Transfer/FileTransferService.cs +++ b/src/Tgstation.Server.Host/Transfer/FileTransferService.cs @@ -118,8 +118,7 @@ namespace Tgstation.Server.Host.Transfer /// public FileTicketResponse CreateDownload(FileDownloadProvider downloadProvider) { - if (downloadProvider == null) - throw new ArgumentNullException(nameof(downloadProvider)); + ArgumentNullException.ThrowIfNull(downloadProvider); logger.LogDebug("Creating download ticket for path {filePath}", downloadProvider.FilePath); var ticketResult = CreateTicket(); @@ -167,8 +166,7 @@ namespace Tgstation.Server.Host.Transfer /// public async Task> RetrieveDownloadStream(FileTicketResponse ticket, CancellationToken cancellationToken) { - if (ticket == null) - throw new ArgumentNullException(nameof(ticket)); + ArgumentNullException.ThrowIfNull(ticket); FileDownloadProvider downloadProvider; lock (downloadTickets) @@ -222,8 +220,7 @@ namespace Tgstation.Server.Host.Transfer /// public async Task SetUploadStream(FileTicketResponse ticket, Stream stream, CancellationToken cancellationToken) { - if (ticket == null) - throw new ArgumentNullException(nameof(ticket)); + ArgumentNullException.ThrowIfNull(ticket); FileUploadProvider uploadProvider; lock (uploadTickets) diff --git a/src/Tgstation.Server.Host/Transfer/FileUploadProvider.cs b/src/Tgstation.Server.Host/Transfer/FileUploadProvider.cs index da51b7d850..f81208601c 100644 --- a/src/Tgstation.Server.Host/Transfer/FileUploadProvider.cs +++ b/src/Tgstation.Server.Host/Transfer/FileUploadProvider.cs @@ -91,8 +91,7 @@ namespace Tgstation.Server.Host.Transfer /// A resulting in , otherwise. public async Task Completion(Stream stream, CancellationToken cancellationToken) { - if (stream == null) - throw new ArgumentNullException(nameof(stream)); + ArgumentNullException.ThrowIfNull(stream); if (ticketExpiryCts.IsCancellationRequested) return new ErrorMessageResponse(ErrorCode.ResourceNotPresent); diff --git a/src/Tgstation.Server.Host/Utils/GitHub/GitHubService.cs b/src/Tgstation.Server.Host/Utils/GitHub/GitHubService.cs index 354f26f9d0..0bf56b6f9d 100644 --- a/src/Tgstation.Server.Host/Utils/GitHub/GitHubService.cs +++ b/src/Tgstation.Server.Host/Utils/GitHub/GitHubService.cs @@ -49,11 +49,9 @@ namespace Tgstation.Server.Host.Utils.GitHub /// public async Task CreateOAuthAccessToken(OAuthConfiguration oAuthConfiguration, string code, CancellationToken cancellationToken) { - if (oAuthConfiguration == null) - throw new ArgumentNullException(nameof(oAuthConfiguration)); + ArgumentNullException.ThrowIfNull(oAuthConfiguration); - if (code == null) - throw new ArgumentNullException(nameof(code)); + ArgumentNullException.ThrowIfNull(code); logger.LogTrace("CreateOAuthAccessToken"); @@ -145,14 +143,11 @@ namespace Tgstation.Server.Host.Utils.GitHub /// public Task CommentOnIssue(string repoOwner, string repoName, string comment, int issueNumber, CancellationToken cancellationToken) { - if (repoOwner == null) - throw new ArgumentNullException(nameof(repoOwner)); + ArgumentNullException.ThrowIfNull(repoOwner); - if (repoName == null) - throw new ArgumentNullException(nameof(repoName)); + ArgumentNullException.ThrowIfNull(repoName); - if (comment == null) - throw new ArgumentNullException(nameof(comment)); + ArgumentNullException.ThrowIfNull(comment); logger.LogTrace("CommentOnIssue"); @@ -170,11 +165,9 @@ namespace Tgstation.Server.Host.Utils.GitHub /// public async Task GetRepositoryId(string repoOwner, string repoName, CancellationToken cancellationToken) { - if (repoOwner == null) - throw new ArgumentNullException(nameof(repoOwner)); + ArgumentNullException.ThrowIfNull(repoOwner); - if (repoName == null) - throw new ArgumentNullException(nameof(repoName)); + ArgumentNullException.ThrowIfNull(repoName); logger.LogTrace("GetRepositoryId"); @@ -191,14 +184,11 @@ namespace Tgstation.Server.Host.Utils.GitHub /// public async Task CreateDeployment(NewDeployment newDeployment, string repoOwner, string repoName, CancellationToken cancellationToken) { - if (newDeployment == null) - throw new ArgumentNullException(nameof(newDeployment)); + ArgumentNullException.ThrowIfNull(newDeployment); - if (repoOwner == null) - throw new ArgumentNullException(nameof(repoOwner)); + ArgumentNullException.ThrowIfNull(repoOwner); - if (repoName == null) - throw new ArgumentNullException(nameof(repoName)); + ArgumentNullException.ThrowIfNull(repoName); logger.LogTrace("CreateDeployment"); @@ -217,14 +207,11 @@ namespace Tgstation.Server.Host.Utils.GitHub /// public Task CreateDeploymentStatus(NewDeploymentStatus newDeploymentStatus, string repoOwner, string repoName, int deploymentId, CancellationToken cancellationToken) { - if (newDeploymentStatus == null) - throw new ArgumentNullException(nameof(newDeploymentStatus)); + ArgumentNullException.ThrowIfNull(newDeploymentStatus); - if (repoOwner == null) - throw new ArgumentNullException(nameof(repoOwner)); + ArgumentNullException.ThrowIfNull(repoOwner); - if (repoName == null) - throw new ArgumentNullException(nameof(repoName)); + ArgumentNullException.ThrowIfNull(repoName); logger.LogTrace("CreateDeploymentStatus"); return gitHubClient @@ -242,8 +229,7 @@ namespace Tgstation.Server.Host.Utils.GitHub /// public Task CreateDeploymentStatus(NewDeploymentStatus newDeploymentStatus, long repoId, int deploymentId, CancellationToken cancellationToken) { - if (newDeploymentStatus == null) - throw new ArgumentNullException(nameof(newDeploymentStatus)); + ArgumentNullException.ThrowIfNull(newDeploymentStatus); logger.LogTrace("CreateDeploymentStatus"); return gitHubClient @@ -260,11 +246,9 @@ namespace Tgstation.Server.Host.Utils.GitHub /// public Task GetPullRequest(string repoOwner, string repoName, int pullRequestNumber, CancellationToken cancellationToken) { - if (repoOwner == null) - throw new ArgumentNullException(nameof(repoOwner)); + ArgumentNullException.ThrowIfNull(repoOwner); - if (repoName == null) - throw new ArgumentNullException(nameof(repoName)); + ArgumentNullException.ThrowIfNull(repoName); logger.LogTrace("GetPullRequest"); return gitHubClient diff --git a/src/Tgstation.Server.Host/Utils/OpenApiEnumVarNamesExtension.cs b/src/Tgstation.Server.Host/Utils/OpenApiEnumVarNamesExtension.cs index 538f4ea84e..a81beb8339 100644 --- a/src/Tgstation.Server.Host/Utils/OpenApiEnumVarNamesExtension.cs +++ b/src/Tgstation.Server.Host/Utils/OpenApiEnumVarNamesExtension.cs @@ -33,8 +33,7 @@ namespace Tgstation.Server.Host.Utils /// The of the being described. public static void Apply(OpenApiSchema openApiSchema, Type enumType) { - if (openApiSchema == null) - throw new ArgumentNullException(nameof(openApiSchema)); + ArgumentNullException.ThrowIfNull(openApiSchema); openApiSchema.Extensions.Add("x-enum-varnames", new OpenApiEnumVarNamesExtension(enumType)); } @@ -42,8 +41,7 @@ namespace Tgstation.Server.Host.Utils /// public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion) { - if (writer == null) - throw new ArgumentNullException(nameof(writer)); + ArgumentNullException.ThrowIfNull(writer); if (specVersion != OpenApiSpecVersion.OpenApi3_0) throw new InvalidOperationException("This extension only applies to OpenAPI 3.0!"); diff --git a/src/Tgstation.Server.Host/Utils/ReferenceCounter.cs b/src/Tgstation.Server.Host/Utils/ReferenceCounter.cs index 95e03ddca6..4351c65db6 100644 --- a/src/Tgstation.Server.Host/Utils/ReferenceCounter.cs +++ b/src/Tgstation.Server.Host/Utils/ReferenceCounter.cs @@ -60,11 +60,9 @@ namespace Tgstation.Server.Host.Utils /// The to take to clean up the reference. public void Initialize(TInstance instance, Action referenceCleanupAction) { - if (instance == null) - throw new ArgumentNullException(nameof(instance)); + ArgumentNullException.ThrowIfNull(instance); - if (referenceCleanupAction == null) - throw new ArgumentNullException(nameof(referenceCleanupAction)); + ArgumentNullException.ThrowIfNull(referenceCleanupAction); lock (initDisposeLock) { diff --git a/src/Tgstation.Server.Host/Utils/SemaphoreSlimContext.cs b/src/Tgstation.Server.Host/Utils/SemaphoreSlimContext.cs index 06e4dbf9a9..cdbe250071 100644 --- a/src/Tgstation.Server.Host/Utils/SemaphoreSlimContext.cs +++ b/src/Tgstation.Server.Host/Utils/SemaphoreSlimContext.cs @@ -17,8 +17,7 @@ namespace Tgstation.Server.Host.Utils /// A resulting in the for the lock. public static async Task Lock(SemaphoreSlim semaphore, CancellationToken cancellationToken) { - if (semaphore == null) - throw new ArgumentNullException(nameof(semaphore)); + ArgumentNullException.ThrowIfNull(semaphore); cancellationToken.ThrowIfCancellationRequested(); await semaphore.WaitAsync(cancellationToken); return new SemaphoreSlimContext(semaphore); diff --git a/src/Tgstation.Server.Host/Utils/SwaggerConfiguration.cs b/src/Tgstation.Server.Host/Utils/SwaggerConfiguration.cs index cd997b3796..367febec2f 100644 --- a/src/Tgstation.Server.Host/Utils/SwaggerConfiguration.cs +++ b/src/Tgstation.Server.Host/Utils/SwaggerConfiguration.cs @@ -330,10 +330,8 @@ namespace Tgstation.Server.Host.Utils /// public void Apply(OpenApiOperation operation, OperationFilterContext context) { - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - if (context == null) - throw new ArgumentNullException(nameof(context)); + ArgumentNullException.ThrowIfNull(operation); + ArgumentNullException.ThrowIfNull(context); operation.OperationId = $"{context.MethodInfo.DeclaringType.Name}.{context.MethodInfo.Name}"; @@ -458,10 +456,8 @@ namespace Tgstation.Server.Host.Utils /// public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) { - if (swaggerDoc == null) - throw new ArgumentNullException(nameof(swaggerDoc)); - if (context == null) - throw new ArgumentNullException(nameof(context)); + ArgumentNullException.ThrowIfNull(swaggerDoc); + ArgumentNullException.ThrowIfNull(context); swaggerDoc.ExternalDocs = new OpenApiExternalDocs { @@ -541,10 +537,8 @@ namespace Tgstation.Server.Host.Utils /// public void Apply(OpenApiSchema schema, SchemaFilterContext context) { - if (schema == null) - throw new ArgumentNullException(nameof(schema)); - if (context == null) - throw new ArgumentNullException(nameof(context)); + ArgumentNullException.ThrowIfNull(schema); + ArgumentNullException.ThrowIfNull(context); // Nothing is required schema.Required.Clear(); @@ -566,10 +560,8 @@ namespace Tgstation.Server.Host.Utils /// public void Apply(OpenApiRequestBody requestBody, RequestBodyFilterContext context) { - if (requestBody == null) - throw new ArgumentNullException(nameof(requestBody)); - if (context == null) - throw new ArgumentNullException(nameof(context)); + ArgumentNullException.ThrowIfNull(requestBody); + ArgumentNullException.ThrowIfNull(context); requestBody.Required = true; } diff --git a/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs b/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs index e8478c794b..87fa57f18c 100644 --- a/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs +++ b/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs @@ -86,8 +86,7 @@ namespace Tgstation.Server.Tests.Live public override Task SendMessage(Message replyTo, MessageContent message, ulong channelId, CancellationToken cancellationToken) { - if (message == null) - throw new ArgumentNullException(nameof(message)); + ArgumentNullException.ThrowIfNull(message); Assert.IsTrue(knownChannels.ContainsKey(channelId)); @@ -102,14 +101,10 @@ namespace Tgstation.Server.Tests.Live public override Task> SendUpdateMessage(RevisionInformation revisionInformation, Version byondVersion, DateTimeOffset? estimatedCompletionTime, string gitHubOwner, string gitHubRepo, ulong channelId, bool localCommitPushed, CancellationToken cancellationToken) { - if (revisionInformation == null) - throw new ArgumentNullException(nameof(revisionInformation)); - if (byondVersion == null) - throw new ArgumentNullException(nameof(byondVersion)); - if (gitHubOwner == null) - throw new ArgumentNullException(nameof(gitHubOwner)); - if (gitHubRepo == null) - throw new ArgumentNullException(nameof(gitHubRepo)); + ArgumentNullException.ThrowIfNull(revisionInformation); + ArgumentNullException.ThrowIfNull(byondVersion); + ArgumentNullException.ThrowIfNull(gitHubOwner); + ArgumentNullException.ThrowIfNull(gitHubRepo); Assert.IsTrue(knownChannels.ContainsKey(channelId)); diff --git a/tests/Tgstation.Server.Tests/Live/DummyChatProviderFactory.cs b/tests/Tgstation.Server.Tests/Live/DummyChatProviderFactory.cs index 762ad7294c..d4d7c98b09 100644 --- a/tests/Tgstation.Server.Tests/Live/DummyChatProviderFactory.cs +++ b/tests/Tgstation.Server.Tests/Live/DummyChatProviderFactory.cs @@ -67,8 +67,7 @@ namespace Tgstation.Server.Tests.Live public IProvider CreateProvider(ChatBot settings) { logger.LogTrace("CreateProvider"); - if (settings == null) - throw new ArgumentNullException(nameof(settings)); + ArgumentNullException.ThrowIfNull(settings); var provider = settings.Provider; switch (provider) diff --git a/tests/Tgstation.Server.Tests/Live/DummyGitHubServiceFactory.cs b/tests/Tgstation.Server.Tests/Live/DummyGitHubServiceFactory.cs index 59bef5fdd0..7df388085e 100644 --- a/tests/Tgstation.Server.Tests/Live/DummyGitHubServiceFactory.cs +++ b/tests/Tgstation.Server.Tests/Live/DummyGitHubServiceFactory.cs @@ -22,8 +22,7 @@ namespace Tgstation.Server.Tests.Live public IAuthenticatedGitHubService CreateService(string accessToken) { - if (accessToken == null) - throw new ArgumentNullException(nameof(accessToken)); + ArgumentNullException.ThrowIfNull(accessToken); return CreateDummyService(); } From e6f142d92701a8652e189d68d454e275fb4d3c81 Mon Sep 17 00:00:00 2001 From: Dominion Date: Mon, 12 Jun 2023 20:43:49 -0400 Subject: [PATCH 02/10] Cleanup DummyChatProvider --- tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs b/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs index 87fa57f18c..ac17312614 100644 --- a/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs +++ b/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs @@ -195,12 +195,10 @@ namespace Tgstation.Server.Tests.Live return CloneChannel(entry); } - ChannelRepresentation CloneChannel(ChannelRepresentation channel) - { - return JsonConvert.DeserializeObject( + static ChannelRepresentation CloneChannel(ChannelRepresentation channel) + => JsonConvert.DeserializeObject( JsonConvert.SerializeObject( channel)); - } async Task RandomMessageLoop(CancellationToken cancellationToken) { @@ -235,7 +233,7 @@ namespace Tgstation.Server.Tests.Live var index = random.Next(0, enumerator.Count); channel = enumerator[index].Value; - username = channel.ConnectionName.Substring(0, channel.ConnectionName.Length - 11); + username = channel.ConnectionName[..^11]; } else { From 6fbbbc505c16659f9d9c26ad9168096cc07ff87f Mon Sep 17 00:00:00 2001 From: Dominion Date: Mon, 12 Jun 2023 20:45:14 -0400 Subject: [PATCH 03/10] Add missing ArgumentNullException throw --- src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs index bfc541e6f9..fc41294fdc 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs @@ -131,6 +131,8 @@ namespace Tgstation.Server.Host.Components.Chat.Providers /// public async Task>> MapChannels(IEnumerable channels, CancellationToken cancellationToken) { + ArgumentNullException.ThrowIfNull(channels); + try { return await MapChannelsImpl(channels, cancellationToken); From 09c9b6848d74a31715199d0b86e2190bad8239c9 Mon Sep 17 00:00:00 2001 From: Dominion Date: Tue, 13 Jun 2023 01:02:28 -0400 Subject: [PATCH 04/10] Use `CancellationToken.None` instead of `default` --- src/Tgstation.Server.Host.Service/Program.cs | 3 ++- .../Components/Chat/Providers/DiscordProvider.cs | 7 +++---- .../Components/Chat/Providers/IrcProvider.cs | 2 +- .../Components/Chat/Providers/Provider.cs | 1 - .../Components/Deployment/DmbFactory.cs | 2 +- .../Components/Deployment/DreamMaker.cs | 10 +++++----- src/Tgstation.Server.Host/Components/Instance.cs | 2 +- .../Components/InstanceManager.cs | 6 +++--- .../Components/Repository/RepositoryManager.cs | 2 +- .../Components/Session/SessionController.cs | 6 +++++- .../Components/Session/SessionControllerFactory.cs | 2 +- .../Components/Watchdog/BasicWatchdog.cs | 2 +- .../Components/Watchdog/WatchdogBase.cs | 4 ++-- .../Controllers/InstanceController.cs | 6 +++--- src/Tgstation.Server.Host/Jobs/JobService.cs | 2 +- src/Tgstation.Server.Host/Program.cs | 3 ++- src/Tgstation.Server.Host/Swarm/SwarmService.cs | 2 +- src/Tgstation.Server.Host/System/Process.cs | 2 +- 18 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/Tgstation.Server.Host.Service/Program.cs b/src/Tgstation.Server.Host.Service/Program.cs index 95afc4ca21..fa7c05e672 100644 --- a/src/Tgstation.Server.Host.Service/Program.cs +++ b/src/Tgstation.Server.Host.Service/Program.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Reflection; using System.Security.Principal; using System.ServiceProcess; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -189,7 +190,7 @@ namespace Tgstation.Server.Host.Service if (Configure) { using (var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole())) - await WatchdogFactory.CreateWatchdog(loggerFactory).RunAsync(true, Array.Empty(), default); // DCT: None available + await WatchdogFactory.CreateWatchdog(loggerFactory).RunAsync(true, Array.Empty(), CancellationToken.None); // DCT: None available } } } diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs index 805ac1dc6a..43fcf942b4 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs @@ -258,7 +258,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers { // drain the channel, fuck the results // DCT: None available - await foreach (var result in channel.Reader.ReadAllAsync(default)) + await foreach (var result in channel.Reader.ReadAllAsync(CancellationToken.None)) try { await result; @@ -530,7 +530,6 @@ namespace Tgstation.Server.Host.Components.Chat.Providers if (basedMeme && messageCreateEvent.Content.Equals("Based on what?", StringComparison.OrdinalIgnoreCase)) { - // DCT: None available await SendMessage( new DiscordMessage { @@ -541,7 +540,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers Text = "https://youtu.be/LrNu-SuFF_o", }, messageCreateEvent.ChannelID.Value, - default); + cancellationToken); return Result.FromSuccess(); } @@ -687,7 +686,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers { // will handle cleanup // DCT: Musn't abort - await DisconnectImpl(default); + await DisconnectImpl(CancellationToken.None); throw; } } diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/IrcProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/IrcProvider.cs index 91b43c6fb5..3312e4b8b4 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/IrcProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/IrcProvider.cs @@ -160,7 +160,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers await base.DisposeAsync(); // DCT: None available - await HardDisconnect(default); + await HardDisconnect(CancellationToken.None); } /// diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs index fc41294fdc..1fad402354 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs @@ -310,7 +310,6 @@ namespace Tgstation.Server.Host.Components.Chat.Providers }, cancellationToken); - // DCT: Always wait for the job to complete here await jobManager.WaitForJobCompletion(job, null, cancellationToken, cancellationToken); } } diff --git a/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs b/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs index 76f8c3af5b..57c177dbb0 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs @@ -402,7 +402,7 @@ namespace Tgstation.Server.Host.Components.Deployment var remoteDeploymentManager = remoteDeploymentManagerFactory.CreateRemoteDeploymentManager(metadata, job); // DCT: None available - var deploymentJob = remoteDeploymentManager.MarkInactive(job, default); + var deploymentJob = remoteDeploymentManager.MarkInactive(job, CancellationToken.None); var deleteTask = DeleteCompileJobContent(job.DirectoryName.ToString(), cleanupCts.Token); var otherTask = cleanupTask; diff --git a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs index 3fc0003c50..aefba4f9e7 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs @@ -364,7 +364,7 @@ namespace Tgstation.Server.Host.Components.Deployment databaseContext.CompileJobs.Remove(compileJob); // DCT: Cancellation token is for job, operation must run regardless - await databaseContext.Save(default); + await databaseContext.Save(CancellationToken.None); throw; } @@ -537,7 +537,7 @@ namespace Tgstation.Server.Host.Components.Deployment { // DCT: Cancellation token is for job, delaying here is fine progressReporter.StageName = "Running CompileCancelled event"; - await eventConsumer.HandleEvent(EventType.CompileCancelled, Enumerable.Empty(), default); + await eventConsumer.HandleEvent(EventType.CompileCancelled, Enumerable.Empty(), CancellationToken.None); throw; } finally @@ -951,8 +951,8 @@ namespace Tgstation.Server.Host.Components.Deployment try { // DCT: None available - await eventConsumer.HandleEvent(EventType.DeploymentCleanup, new List { jobPath }, default); - await ioManager.DeleteDirectory(jobPath, default); + await eventConsumer.HandleEvent(EventType.DeploymentCleanup, new List { jobPath }, CancellationToken.None); + await ioManager.DeleteDirectory(jobPath, CancellationToken.None); } catch (Exception e) { @@ -966,7 +966,7 @@ namespace Tgstation.Server.Host.Components.Deployment remoteDeploymentManager.FailDeployment( job, FormatExceptionForUsers(exception), - default)); + CancellationToken.None)); } } } diff --git a/src/Tgstation.Server.Host/Components/Instance.cs b/src/Tgstation.Server.Host/Components/Instance.cs index 42e18fa43b..2f3cc1f1bf 100644 --- a/src/Tgstation.Server.Host/Components/Instance.cs +++ b/src/Tgstation.Server.Host/Components/Instance.cs @@ -471,7 +471,7 @@ namespace Tgstation.Server.Host.Components catch { // DCT: Cancellation token is for job, operation must run regardless - await repo.ResetToSha(startSha, progressReporter, default); + await repo.ResetToSha(startSha, progressReporter, CancellationToken.None); throw; } }); diff --git a/src/Tgstation.Server.Host/Components/InstanceManager.cs b/src/Tgstation.Server.Host/Components/InstanceManager.cs index 9e58365dfd..b82bec8f03 100644 --- a/src/Tgstation.Server.Host/Components/InstanceManager.cs +++ b/src/Tgstation.Server.Host/Components/InstanceManager.cs @@ -266,7 +266,7 @@ namespace Tgstation.Server.Host.Components }; db.Instances.Attach(targetInstance); targetInstance.Path = oldPath; - return db.Save(default); + return db.Save(CancellationToken.None); }); } catch (Exception innerEx) @@ -282,7 +282,7 @@ namespace Tgstation.Server.Host.Components await ioManager.WriteAllBytes( ioManager.ConcatPath(oldPath, InstanceController.InstanceAttachFileName), Array.Empty(), - default); + CancellationToken.None); } catch (Exception tripleEx) { @@ -398,7 +398,7 @@ namespace Tgstation.Server.Host.Components try { // DCT: Must always run - await instance.StopAsync(default); + await instance.StopAsync(CancellationToken.None); } catch (Exception innerEx) { diff --git a/src/Tgstation.Server.Host/Components/Repository/RepositoryManager.cs b/src/Tgstation.Server.Host/Components/Repository/RepositoryManager.cs index 6a654a597e..ebe99aa808 100644 --- a/src/Tgstation.Server.Host/Components/Repository/RepositoryManager.cs +++ b/src/Tgstation.Server.Host/Components/Repository/RepositoryManager.cs @@ -175,7 +175,7 @@ namespace Tgstation.Server.Host.Components.Repository logger.LogTrace("Deleting partially cloned repository..."); // DCT: Cancellation token is for job, operation must run regardless - await ioManager.DeleteDirectory(repositoryPath, default); + await ioManager.DeleteDirectory(repositoryPath, CancellationToken.None); } catch (Exception innerException) { diff --git a/src/Tgstation.Server.Host/Components/Session/SessionController.cs b/src/Tgstation.Server.Host/Components/Session/SessionController.cs index 9242b02c0c..a1a8632dee 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionController.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionController.cs @@ -544,7 +544,11 @@ namespace Tgstation.Server.Host.Components.Session var toAwait = Task.WhenAny(startupTask, process.Lifetime); if (startupTimeout.HasValue) - toAwait = Task.WhenAny(toAwait, asyncDelayer.Delay(TimeSpan.FromSeconds(startupTimeout.Value), default)); // DCT: None available, task will clean up after delay + toAwait = Task.WhenAny( + toAwait, + asyncDelayer.Delay( + TimeSpan.FromSeconds(startupTimeout.Value), + CancellationToken.None)); // DCT: None available, task will clean up after delay Logger.LogTrace( "Waiting for LaunchResult based on {launchResultCompletionCause}{possibleTimeout}...", diff --git a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs index de3acc2431..fb5cb1d020 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs @@ -353,7 +353,7 @@ namespace Tgstation.Server.Host.Components.Session asyncDelayer, loggerFactory.CreateLogger(), () => !launchParameters.LogOutput.Value - ? LogDDOutput(process, outputFilePath, byondLock.SupportsCli, default) // DCT: None available + ? LogDDOutput(process, outputFilePath, byondLock.SupportsCli, CancellationToken.None) // DCT: None available : Task.CompletedTask, launchParameters.StartupTimeout, false, diff --git a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs index 7a561d2d50..713a7e193a 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs @@ -256,7 +256,7 @@ namespace Tgstation.Server.Host.Components.Watchdog bool serverWasActive = Server != null; // DCT: Operation must always run - await DisposeAndNullControllers(default); + await DisposeAndNullControllers(CancellationToken.None); // server didn't get control of this dmb if (dmbToUse != null && !serverWasActive) diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs index 8eb3cb66ae..b6e8180a2d 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs @@ -611,7 +611,7 @@ namespace Tgstation.Server.Host.Components.Watchdog { // we lost the server, just restart entirely // DCT: Operation must always run - await DisposeAndNullControllers(default); + await DisposeAndNullControllers(CancellationToken.None); const string FailReattachMessage = "Unable to properly reattach to server! Restarting watchdog..."; Logger.LogWarning(FailReattachMessage); @@ -975,7 +975,7 @@ namespace Tgstation.Server.Host.Components.Watchdog } // DCT: Operation must always run - await DisposeAndNullControllers(default); + await DisposeAndNullControllers(CancellationToken.None); Status = WatchdogStatus.Offline; Logger.LogTrace("Monitor exiting..."); diff --git a/src/Tgstation.Server.Host/Controllers/InstanceController.cs b/src/Tgstation.Server.Host/Controllers/InstanceController.cs index 716d8e9d58..5093a163ab 100644 --- a/src/Tgstation.Server.Host/Controllers/InstanceController.cs +++ b/src/Tgstation.Server.Host/Controllers/InstanceController.cs @@ -242,7 +242,7 @@ namespace Tgstation.Server.Host.Controllers DatabaseContext.Instances.Remove(newInstance); // DCT: Operation must always run - await DatabaseContext.Save(default); + await DatabaseContext.Save(CancellationToken.None); throw; } } @@ -302,7 +302,7 @@ namespace Tgstation.Server.Host.Controllers catch (OperationCanceledException) { // DCT: Operation must always run - await ioManager.DeleteFile(attachFileName, default); + await ioManager.DeleteFile(attachFileName, CancellationToken.None); throw; } @@ -458,7 +458,7 @@ namespace Tgstation.Server.Host.Controllers originalModel.Path = originalModelPath; // DCT: Operation must always run - await DatabaseContext.Save(default); + await DatabaseContext.Save(CancellationToken.None); throw; } diff --git a/src/Tgstation.Server.Host/Jobs/JobService.cs b/src/Tgstation.Server.Host/Jobs/JobService.cs index 2a186fb2ae..6f8b3901fe 100644 --- a/src/Tgstation.Server.Host/Jobs/JobService.cs +++ b/src/Tgstation.Server.Host/Jobs/JobService.cs @@ -366,7 +366,7 @@ namespace Tgstation.Server.Host.Jobs attachedJob.Cancelled = job.Cancelled; // DCT: Cancellation token is for job, operation should always run - await databaseContext.Save(default); + await databaseContext.Save(CancellationToken.None); }); } finally diff --git a/src/Tgstation.Server.Host/Program.cs b/src/Tgstation.Server.Host/Program.cs index 5d7bd6f4f4..c3cb30fdbc 100644 --- a/src/Tgstation.Server.Host/Program.cs +++ b/src/Tgstation.Server.Host/Program.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Host.Common; @@ -110,7 +111,7 @@ namespace Tgstation.Server.Host if (updatePath != null) { // DCT: None available, operation should always run - await ServerFactory.IOManager.WriteAllBytes(updatePath, Encoding.UTF8.GetBytes(e.ToString()), default); + await ServerFactory.IOManager.WriteAllBytes(updatePath, Encoding.UTF8.GetBytes(e.ToString()), CancellationToken.None); return HostExitCode.Error; } diff --git a/src/Tgstation.Server.Host/Swarm/SwarmService.cs b/src/Tgstation.Server.Host/Swarm/SwarmService.cs index 952ffaba55..1e22691426 100644 --- a/src/Tgstation.Server.Host/Swarm/SwarmService.cs +++ b/src/Tgstation.Server.Host/Swarm/SwarmService.cs @@ -684,7 +684,7 @@ namespace Tgstation.Server.Host.Swarm try { // DCT: Intentionally should not be cancelled - using var response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseContentRead, default); + using var response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseContentRead, CancellationToken.None); response.EnsureSuccessStatusCode(); } catch (Exception ex) diff --git a/src/Tgstation.Server.Host/System/Process.cs b/src/Tgstation.Server.Host/System/Process.cs index 16d97ec69e..883c9e9946 100644 --- a/src/Tgstation.Server.Host/System/Process.cs +++ b/src/Tgstation.Server.Host/System/Process.cs @@ -106,7 +106,7 @@ namespace Tgstation.Server.Host.System logger.LogTrace(ex, "WaitForInputIdle() failed, this is normal."); } }, - default, // DCT: None available + CancellationToken.None, // DCT: None available DefaultIOManager.BlockingTaskCreationOptions, TaskScheduler.Current); From 324d0b4d30699e5da185aee4c3a464a58dd4e5b6 Mon Sep 17 00:00:00 2001 From: Dominion Date: Tue, 13 Jun 2023 01:10:48 -0400 Subject: [PATCH 05/10] Cleanup Program.cs for service --- src/Tgstation.Server.Host.Service/Program.cs | 46 ++++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/Tgstation.Server.Host.Service/Program.cs b/src/Tgstation.Server.Host.Service/Program.cs index fa7c05e672..e1e6e2f992 100644 --- a/src/Tgstation.Server.Host.Service/Program.cs +++ b/src/Tgstation.Server.Host.Service/Program.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using McMaster.Extensions.CommandLineUtils; + using Microsoft.Extensions.Logging; using Tgstation.Server.Host.Watchdog; @@ -100,30 +101,26 @@ namespace Tgstation.Server.Host.Service } // And remove it - using (ServiceInstaller si = new ServiceInstaller()) - { - si.Context = new InstallContext($"old-{sc.ServiceName}-uninstall.log", null); - si.ServiceName = sc.ServiceName; - si.Uninstall(null); - } + using var serviceInstaller = new ServiceInstaller(); + serviceInstaller.Context = new InstallContext($"old-{sc.ServiceName}-uninstall.log", null); + serviceInstaller.ServiceName = sc.ServiceName; + serviceInstaller.Uninstall(null); } - using (var processInstaller = new ServiceProcessInstaller()) - using (var installer = new ServiceInstaller()) - { - processInstaller.Account = ServiceAccount.LocalSystem; + using var processInstaller = new ServiceProcessInstaller(); + using var installer = new ServiceInstaller(); + processInstaller.Account = ServiceAccount.LocalSystem; - installer.Context = new InstallContext("tgs-install.log", new string[] { String.Format(CultureInfo.InvariantCulture, "/assemblypath={0}", Assembly.GetEntryAssembly().Location) }); - installer.Description = "/tg/station 13 server running as a windows service"; - installer.DisplayName = "/tg/station server"; - installer.StartType = ServiceStartMode.Automatic; - installer.ServicesDependedOn = new string[] { "Tcpip", "Dhcp", "Dnscache" }; - installer.ServiceName = ServerService.Name; - installer.Parent = processInstaller; + installer.Context = new InstallContext("tgs-install.log", new string[] { String.Format(CultureInfo.InvariantCulture, "/assemblypath={0}", Assembly.GetEntryAssembly().Location) }); + installer.Description = "/tg/station 13 server running as a windows service"; + installer.DisplayName = "/tg/station server"; + installer.StartType = ServiceStartMode.Automatic; + installer.ServicesDependedOn = new string[] { "Tcpip", "Dhcp", "Dnscache" }; + installer.ServiceName = ServerService.Name; + installer.Parent = processInstaller; - var state = new ListDictionary(); - installer.Install(state); - } + var state = new ListDictionary(); + installer.Install(state); } /// @@ -183,14 +180,15 @@ namespace Tgstation.Server.Host.Service } else if (!Configure) { - using (var service = new ServerService(WatchdogFactory, Trace ? LogLevel.Trace : Debug ? LogLevel.Debug : LogLevel.Information)) - ServiceBase.Run(service); + using var service = new ServerService(WatchdogFactory, Trace ? LogLevel.Trace : Debug ? LogLevel.Debug : LogLevel.Information); + ServiceBase.Run(service); } if (Configure) { - using (var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole())) - await WatchdogFactory.CreateWatchdog(loggerFactory).RunAsync(true, Array.Empty(), CancellationToken.None); // DCT: None available + using var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); + await WatchdogFactory.CreateWatchdog(loggerFactory) + .RunAsync(true, Array.Empty(), CancellationToken.None); // DCT: None available } } } From c5d9122f203f7c64fa8f168eb950efff832948e2 Mon Sep 17 00:00:00 2001 From: Dominion Date: Tue, 13 Jun 2023 01:24:40 -0400 Subject: [PATCH 06/10] Nuget Package updates - Contains workaround for breaking change in Microsoft.Data.SqlClient --- .../Tgstation.Server.Host.Console.csproj | 2 +- .../Tgstation.Server.Host.Service.csproj | 4 +-- .../Tgstation.Server.Host.Watchdog.csproj | 2 +- .../.config/dotnet-tools.json | 2 +- .../Chat/Providers/DiscordProvider.cs | 4 --- .../Database/SqlServerDatabaseContext.cs | 19 +++++++++++++- .../Tgstation.Server.Host.csproj | 25 +++++++++---------- .../Tgstation.Server.Api.Tests.csproj | 10 ++++---- .../Tgstation.Server.Client.Tests.csproj | 10 ++++---- ...Tgstation.Server.Host.Console.Tests.csproj | 10 ++++---- ...Tgstation.Server.Host.Service.Tests.csproj | 10 ++++---- ...Tgstation.Server.Host.Tests.Signals.csproj | 2 +- .../Tgstation.Server.Host.Tests.csproj | 10 ++++---- ...gstation.Server.Host.Watchdog.Tests.csproj | 10 ++++---- .../Tgstation.Server.Tests.csproj | 10 ++++---- tools/ReleaseNotes/ReleaseNotes.csproj | 2 +- 16 files changed, 72 insertions(+), 60 deletions(-) diff --git a/src/Tgstation.Server.Host.Console/Tgstation.Server.Host.Console.csproj b/src/Tgstation.Server.Host.Console/Tgstation.Server.Host.Console.csproj index 4d433b2c54..b32fe038fd 100644 --- a/src/Tgstation.Server.Host.Console/Tgstation.Server.Host.Console.csproj +++ b/src/Tgstation.Server.Host.Console/Tgstation.Server.Host.Console.csproj @@ -24,7 +24,7 @@ - + all diff --git a/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj b/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj index 6f496e9c5e..83630ddc2e 100644 --- a/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj +++ b/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj @@ -24,9 +24,9 @@ - + - + all diff --git a/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj b/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj index 4fb825d496..97c746f05c 100644 --- a/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj +++ b/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj @@ -23,7 +23,7 @@ - + all diff --git a/src/Tgstation.Server.Host/.config/dotnet-tools.json b/src/Tgstation.Server.Host/.config/dotnet-tools.json index 5bc20db4c2..63b3cd62dd 100644 --- a/src/Tgstation.Server.Host/.config/dotnet-tools.json +++ b/src/Tgstation.Server.Host/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "dotnet-ef": { - "version": "6.0.16", + "version": "7.0.5", "commands": [ "dotnet-ef" ] diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs index 43fcf942b4..81b652cf49 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs @@ -227,10 +227,6 @@ namespace Tgstation.Server.Host.Components.Chat.Providers await base.DisposeAsync(); -#if NET7_0_OR_GREATER -#error This hack needs to be removed after updating Remora.Discord -#endif - // https://github.com/Remora/Remora.Discord/issues/305 var responderDispatchService = serviceProvider.GetRequiredService(); var serviceProviderDisposeTask = serviceProvider.DisposeAsync().AsTask(); diff --git a/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs b/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs index c3d81f1321..a5b5d2319a 100644 --- a/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs @@ -1,4 +1,5 @@ using System; +using System.Data.SqlClient; using Microsoft.EntityFrameworkCore; @@ -32,8 +33,24 @@ namespace Tgstation.Server.Host.Database if (databaseConfiguration.DatabaseType != DatabaseType.SqlServer) throw new InvalidOperationException($"Invalid DatabaseType for {nameof(SqlServerDatabaseContext)}!"); +#if NET7_0_OR_GREATER +#error Perform this breaking config change +#endif + + // Workaround for breaking change https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-7.0/breaking-changes#encrypt-true + var connectionString = databaseConfiguration.ConnectionString; + if (!connectionString.Contains("Encrypt=", StringComparison.OrdinalIgnoreCase)) + { + var connectionStringBuilder = new SqlConnectionStringBuilder(databaseConfiguration.ConnectionString) + { + Encrypt = false, + }; + + connectionString = connectionStringBuilder.ToString(); + } + options.UseSqlServer( - databaseConfiguration.ConnectionString, + connectionString, sqlServerOptions => { sqlServerOptions.EnableRetryOnFailure(); diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 2d617e7e27..a745a554e9 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -82,31 +82,30 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + - + - + - - + - + @@ -127,13 +126,13 @@ - + - + - + - + diff --git a/tests/Tgstation.Server.Api.Tests/Tgstation.Server.Api.Tests.csproj b/tests/Tgstation.Server.Api.Tests/Tgstation.Server.Api.Tests.csproj index 228076f720..4cdf2fb2a0 100644 --- a/tests/Tgstation.Server.Api.Tests/Tgstation.Server.Api.Tests.csproj +++ b/tests/Tgstation.Server.Api.Tests/Tgstation.Server.Api.Tests.csproj @@ -6,18 +6,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/tests/Tgstation.Server.Client.Tests/Tgstation.Server.Client.Tests.csproj b/tests/Tgstation.Server.Client.Tests/Tgstation.Server.Client.Tests.csproj index 80045fed78..6b82ba7671 100644 --- a/tests/Tgstation.Server.Client.Tests/Tgstation.Server.Client.Tests.csproj +++ b/tests/Tgstation.Server.Client.Tests/Tgstation.Server.Client.Tests.csproj @@ -6,18 +6,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/tests/Tgstation.Server.Host.Console.Tests/Tgstation.Server.Host.Console.Tests.csproj b/tests/Tgstation.Server.Host.Console.Tests/Tgstation.Server.Host.Console.Tests.csproj index 2db70ff886..282b1742c7 100644 --- a/tests/Tgstation.Server.Host.Console.Tests/Tgstation.Server.Host.Console.Tests.csproj +++ b/tests/Tgstation.Server.Host.Console.Tests/Tgstation.Server.Host.Console.Tests.csproj @@ -6,18 +6,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/tests/Tgstation.Server.Host.Service.Tests/Tgstation.Server.Host.Service.Tests.csproj b/tests/Tgstation.Server.Host.Service.Tests/Tgstation.Server.Host.Service.Tests.csproj index 9949a41de4..721a869ca1 100644 --- a/tests/Tgstation.Server.Host.Service.Tests/Tgstation.Server.Host.Service.Tests.csproj +++ b/tests/Tgstation.Server.Host.Service.Tests/Tgstation.Server.Host.Service.Tests.csproj @@ -10,18 +10,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/tests/Tgstation.Server.Host.Tests.Signals/Tgstation.Server.Host.Tests.Signals.csproj b/tests/Tgstation.Server.Host.Tests.Signals/Tgstation.Server.Host.Tests.Signals.csproj index fc6f890674..ce86279440 100644 --- a/tests/Tgstation.Server.Host.Tests.Signals/Tgstation.Server.Host.Tests.Signals.csproj +++ b/tests/Tgstation.Server.Host.Tests.Signals/Tgstation.Server.Host.Tests.Signals.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests/Tgstation.Server.Host.Tests/Tgstation.Server.Host.Tests.csproj b/tests/Tgstation.Server.Host.Tests/Tgstation.Server.Host.Tests.csproj index 5fdf068ab6..b5449c75c4 100644 --- a/tests/Tgstation.Server.Host.Tests/Tgstation.Server.Host.Tests.csproj +++ b/tests/Tgstation.Server.Host.Tests/Tgstation.Server.Host.Tests.csproj @@ -6,18 +6,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/tests/Tgstation.Server.Host.Watchdog.Tests/Tgstation.Server.Host.Watchdog.Tests.csproj b/tests/Tgstation.Server.Host.Watchdog.Tests/Tgstation.Server.Host.Watchdog.Tests.csproj index 5e29d108c4..21a8d65ba5 100644 --- a/tests/Tgstation.Server.Host.Watchdog.Tests/Tgstation.Server.Host.Watchdog.Tests.csproj +++ b/tests/Tgstation.Server.Host.Watchdog.Tests/Tgstation.Server.Host.Watchdog.Tests.csproj @@ -11,18 +11,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj b/tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj index 4f626e1832..7f3dd2a0aa 100644 --- a/tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj +++ b/tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj @@ -6,18 +6,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/tools/ReleaseNotes/ReleaseNotes.csproj b/tools/ReleaseNotes/ReleaseNotes.csproj index 45c7c81ad6..d2a5370e27 100644 --- a/tools/ReleaseNotes/ReleaseNotes.csproj +++ b/tools/ReleaseNotes/ReleaseNotes.csproj @@ -7,7 +7,7 @@ - + From d9110cefbeb1af2e7652e9bdcc98229881f9b36f Mon Sep 17 00:00:00 2001 From: Dominion Date: Tue, 13 Jun 2023 01:24:59 -0400 Subject: [PATCH 07/10] Simplify a `new` expression --- tests/Tgstation.Server.Api.Tests/TestApiHeaders.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Tgstation.Server.Api.Tests/TestApiHeaders.cs b/tests/Tgstation.Server.Api.Tests/TestApiHeaders.cs index 2fd994b284..e53a4f8e1a 100644 --- a/tests/Tgstation.Server.Api.Tests/TestApiHeaders.cs +++ b/tests/Tgstation.Server.Api.Tests/TestApiHeaders.cs @@ -15,7 +15,7 @@ namespace Tgstation.Server.Api.Tests [TestClass] public sealed class TestApiHeaders { - readonly ProductHeaderValue productHeaderValue = new ProductHeaderValue("Tgstation.Server.Api.Tests", "1.0.0"); + readonly ProductHeaderValue productHeaderValue = new ("Tgstation.Server.Api.Tests", "1.0.0"); [TestMethod] public void TestConstruction() From dafbc8b33e46986d21fb4ee11dd9fd9825c74a42 Mon Sep 17 00:00:00 2001 From: Dominion Date: Tue, 13 Jun 2023 01:45:55 -0400 Subject: [PATCH 08/10] Re-include database migrations in CodeCov report --- .codecov.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.codecov.yml b/.codecov.yml index 777b4a5514..452ad2b737 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -8,4 +8,7 @@ coverage: comment: layout: "header, diff, changes" ignore: - - "src/Tgstation.Server.Host/Database/Migrations" + - "src/Tgstation.Server.Host/Database/Migrations/MySqlDatabaseContextModelSnapshot.cs" + - "src/Tgstation.Server.Host/Database/Migrations/PostgresSqlDatabaseContextModelSnapshot.cs" + - "src/Tgstation.Server.Host/Database/Migrations/SqliteDatabaseContextModelSnapshot.cs" + - "src/Tgstation.Server.Host/Database/Migrations/SqlServerDatabaseContextModelSnapshot.cs" From 13d6e44f6061e69d6668e42e0244cd13ff93b45c Mon Sep 17 00:00:00 2001 From: Dominion Date: Tue, 13 Jun 2023 01:43:33 -0400 Subject: [PATCH 09/10] CodeCov settings cleanup Possibly fixes #1541 --- .codecov.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.codecov.yml b/.codecov.yml index 452ad2b737..86207739c5 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -8,7 +8,11 @@ coverage: comment: layout: "header, diff, changes" ignore: + - "src/Tgstation.Server.Host/Database/Design" - "src/Tgstation.Server.Host/Database/Migrations/MySqlDatabaseContextModelSnapshot.cs" - "src/Tgstation.Server.Host/Database/Migrations/PostgresSqlDatabaseContextModelSnapshot.cs" - "src/Tgstation.Server.Host/Database/Migrations/SqliteDatabaseContextModelSnapshot.cs" - "src/Tgstation.Server.Host/Database/Migrations/SqlServerDatabaseContextModelSnapshot.cs" +codecov: + max_report_age: off + require_ci_to_pass: no From 2a2bcf9ed169cdc5919daa7f1c759cbae9bfbbb9 Mon Sep 17 00:00:00 2001 From: Dominion Date: Tue, 13 Jun 2023 18:18:18 -0400 Subject: [PATCH 10/10] The inconsistency in this file name bothers me --- .github/ISSUE_TEMPLATE/{bug-report.md => bug_report.md} | 0 tgstation-server.sln | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/ISSUE_TEMPLATE/{bug-report.md => bug_report.md} (100%) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/ISSUE_TEMPLATE/bug-report.md rename to .github/ISSUE_TEMPLATE/bug_report.md diff --git a/tgstation-server.sln b/tgstation-server.sln index e64d6bf0c7..2b9ab94ed2 100644 --- a/tgstation-server.sln +++ b/tgstation-server.sln @@ -181,7 +181,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildFail", "BuildFail", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{CFFD7992-E73A-4D1F-9D7A-C817C07B7BEB}" ProjectSection(SolutionItems) = preProject - .github\ISSUE_TEMPLATE\bug-report.md = .github\ISSUE_TEMPLATE\bug-report.md + .github\ISSUE_TEMPLATE\bug_report.md = .github\ISSUE_TEMPLATE\bug_report.md .github\ISSUE_TEMPLATE\feature_request.md = .github\ISSUE_TEMPLATE\feature_request.md EndProjectSection EndProject