diff --git a/build/SrcCommon.props b/build/SrcCommon.props index b7f8254e6c..a2f40d20ac 100644 --- a/build/SrcCommon.props +++ b/build/SrcCommon.props @@ -2,9 +2,11 @@ + true false true ../../build/analyzers.ruleset + true bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).xml ClientApp/node_modules ClientApp/node_modules/.install-stamp diff --git a/build/analyzers.ruleset b/build/analyzers.ruleset index 2699bd4001..365db1e57f 100644 --- a/build/analyzers.ruleset +++ b/build/analyzers.ruleset @@ -1,5 +1,5 @@  - + @@ -1026,8 +1026,8 @@ - - + + diff --git a/build/stylecop.json b/build/stylecop.json index bc19a81992..d18cd8693c 100644 --- a/build/stylecop.json +++ b/build/stylecop.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", "settings": { "documentationRules": { "documentPrivateElements": true, @@ -33,6 +34,13 @@ "accessibility" ], "usingDirectivesPlacement": "outsideNamespace" + }, + "namingRules": { + "allowCommonHungarianPrefixes": false, + "includeInferredTupleElementNames": true + }, + "readabilityRules": { + "allowBuiltInTypeAliases": true } } } diff --git a/src/Tgstation.Server.Api/ApiHeaders.cs b/src/Tgstation.Server.Api/ApiHeaders.cs index c8a3093c78..7dc1d79e7e 100644 --- a/src/Tgstation.Server.Api/ApiHeaders.cs +++ b/src/Tgstation.Server.Api/ApiHeaders.cs @@ -124,7 +124,8 @@ namespace Tgstation.Server.Api /// The value of . /// The value of . /// The value of . - public ApiHeaders(ProductHeaderValue userAgent, string token, OAuthProvider? oauthProvider = null) : this(userAgent, token, null, null) + public ApiHeaders(ProductHeaderValue userAgent, string token, OAuthProvider? oauthProvider = null) + : this(userAgent, token, null, null) { if (userAgent == null) throw new ArgumentNullException(nameof(userAgent)); @@ -140,7 +141,8 @@ namespace Tgstation.Server.Api /// The value of . /// The value of . /// The value of . - public ApiHeaders(ProductHeaderValue userAgent, string username, string password) : this(userAgent, null, username, password) + public ApiHeaders(ProductHeaderValue userAgent, string username, string password) + : this(userAgent, null, username, password) { if (userAgent == null) throw new ArgumentNullException(nameof(userAgent)); diff --git a/src/Tgstation.Server.Api/HeadersException.cs b/src/Tgstation.Server.Api/HeadersException.cs index 62bce1433b..6287ee1c88 100644 --- a/src/Tgstation.Server.Api/HeadersException.cs +++ b/src/Tgstation.Server.Api/HeadersException.cs @@ -17,7 +17,8 @@ namespace Tgstation.Server.Api /// /// The value of . /// The error message. - public HeadersException(HeaderTypes missingOrMalformedHeaders, string message) : base(message) + public HeadersException(HeaderTypes missingOrMalformedHeaders, string message) + : base(message) { MissingOrMalformedHeaders = missingOrMalformedHeaders; } @@ -33,7 +34,8 @@ namespace Tgstation.Server.Api /// Initializes a new instance of the class. /// /// The error message. - public HeadersException(string message) : base(message) + public HeadersException(string message) + : base(message) { } @@ -42,7 +44,8 @@ namespace Tgstation.Server.Api /// /// The error message. /// The inner for the base . - public HeadersException(string message, Exception innerException) : base(message, innerException) + public HeadersException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Api/Models/UserName.cs b/src/Tgstation.Server.Api/Models/UserName.cs index c5d5f30604..779f951916 100644 --- a/src/Tgstation.Server.Api/Models/UserName.cs +++ b/src/Tgstation.Server.Api/Models/UserName.cs @@ -24,7 +24,8 @@ /// /// The child of to create. /// A new copied from . - protected virtual TResultType CreateUserName() where TResultType : UserName, new() => new TResultType + protected virtual TResultType CreateUserName() + where TResultType : UserName, new() => new TResultType { Id = Id, Name = Name, diff --git a/src/Tgstation.Server.Api/Rights/RightsHelper.cs b/src/Tgstation.Server.Api/Rights/RightsHelper.cs index 8860391110..eb33954a48 100644 --- a/src/Tgstation.Server.Api/Rights/RightsHelper.cs +++ b/src/Tgstation.Server.Api/Rights/RightsHelper.cs @@ -38,7 +38,8 @@ namespace Tgstation.Server.Api.Rights /// The . /// The . /// A representing the claim role name. - public static string RoleNames(TRight right) where TRight : Enum + public static string RoleNames(TRight right) + where TRight : Enum { IEnumerable GetRoleNames() { @@ -75,7 +76,8 @@ namespace Tgstation.Server.Api.Rights /// /// The . /// All rights for the given . - public static TRight AllRights() where TRight : Enum + public static TRight AllRights() + where TRight : Enum { ulong rights = 0; foreach (Enum right in Enum.GetValues(typeof(TRight))) @@ -91,7 +93,8 @@ namespace Tgstation.Server.Api.Rights /// The . /// The s to clamp. /// The clamped . - public static TRight Clamp(TRight rights) where TRight : Enum + public static TRight Clamp(TRight rights) + where TRight : Enum { var allRights = AllRights(); diff --git a/src/Tgstation.Server.Client/ApiClient.cs b/src/Tgstation.Server.Client/ApiClient.cs index ae10ac62af..939fdb2dc8 100644 --- a/src/Tgstation.Server.Client/ApiClient.cs +++ b/src/Tgstation.Server.Client/ApiClient.cs @@ -168,55 +168,78 @@ namespace Tgstation.Server.Client } /// - public Task Create(string route, CancellationToken cancellationToken) => RunRequest(route, new object(), HttpMethod.Put, null, false, cancellationToken); + public Task Create(string route, CancellationToken cancellationToken) + => RunRequest(route, new object(), HttpMethod.Put, null, false, cancellationToken); /// - public Task Read(string route, CancellationToken cancellationToken) => RunRequest(route, null, HttpMethod.Get, null, false, cancellationToken); + public Task Read(string route, CancellationToken cancellationToken) + => RunRequest(route, null, HttpMethod.Get, null, false, cancellationToken); /// - public Task Update(string route, CancellationToken cancellationToken) => RunRequest(route, new object(), HttpMethod.Post, null, false, cancellationToken); + public Task Update(string route, CancellationToken cancellationToken) + => RunRequest(route, new object(), HttpMethod.Post, null, false, cancellationToken); /// - public Task Update(string route, TBody body, CancellationToken cancellationToken) where TBody : class => RunRequest(route, body, HttpMethod.Post, null, false, cancellationToken); + public Task Update(string route, TBody body, CancellationToken cancellationToken) + where TBody : class + => RunRequest(route, body, HttpMethod.Post, null, false, cancellationToken); /// public Task Patch(string route, CancellationToken cancellationToken) => RunRequest(route, null, HttpPatch, null, false, cancellationToken); /// - public Task Update(string route, TBody body, CancellationToken cancellationToken) where TBody : class => RunRequest(route, body, HttpMethod.Post, null, false, cancellationToken); + public Task Update(string route, TBody body, CancellationToken cancellationToken) + where TBody : class + => RunRequest(route, body, HttpMethod.Post, null, false, cancellationToken); /// - public Task Create(string route, TBody body, CancellationToken cancellationToken) where TBody : class => RunRequest(route, body, HttpMethod.Put, null, false, cancellationToken); + public Task Create(string route, TBody body, CancellationToken cancellationToken) + where TBody : class + => RunRequest(route, body, HttpMethod.Put, null, false, cancellationToken); /// - public Task Delete(string route, CancellationToken cancellationToken) => RunRequest(route, null, HttpMethod.Delete, null, false, cancellationToken); + public Task Delete(string route, CancellationToken cancellationToken) + => RunRequest(route, null, HttpMethod.Delete, null, false, cancellationToken); /// - public Task Create(string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class => RunRequest(route, body, HttpMethod.Put, instanceId, false, cancellationToken); + public Task Create(string route, TBody body, long instanceId, CancellationToken cancellationToken) + where TBody : class + => RunRequest(route, body, HttpMethod.Put, instanceId, false, cancellationToken); /// - public Task Read(string route, long instanceId, CancellationToken cancellationToken) => RunRequest(route, null, HttpMethod.Get, instanceId, false, cancellationToken); + public Task Read(string route, long instanceId, CancellationToken cancellationToken) + => RunRequest(route, null, HttpMethod.Get, instanceId, false, cancellationToken); /// - public Task Update(string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class => RunRequest(route, body, HttpMethod.Post, instanceId, false, cancellationToken); + public Task Update(string route, TBody body, long instanceId, CancellationToken cancellationToken) + where TBody : class + => RunRequest(route, body, HttpMethod.Post, instanceId, false, cancellationToken); /// - public Task Delete(string route, long instanceId, CancellationToken cancellationToken) => RunRequest(route, null, HttpMethod.Delete, instanceId, false, cancellationToken); + public Task Delete(string route, long instanceId, CancellationToken cancellationToken) + => RunRequest(route, null, HttpMethod.Delete, instanceId, false, cancellationToken); /// - public Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class => RunRequest(route, body, HttpMethod.Delete, instanceId, false, cancellationToken); + public Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) + where TBody : class + => RunRequest(route, body, HttpMethod.Delete, instanceId, false, cancellationToken); /// - public Task Delete(string route, long instanceId, CancellationToken cancellationToken) => RunRequest(route, null, HttpMethod.Delete, instanceId, false, cancellationToken); + public Task Delete(string route, long instanceId, CancellationToken cancellationToken) + => RunRequest(route, null, HttpMethod.Delete, instanceId, false, cancellationToken); /// - public Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class => RunRequest(route, body, HttpMethod.Delete, instanceId, false, cancellationToken); + public Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) + where TBody : class + => RunRequest(route, body, HttpMethod.Delete, instanceId, false, cancellationToken); /// - public Task Create(string route, long instanceId, CancellationToken cancellationToken) => RunRequest(route, new object(), HttpMethod.Put, instanceId, false, cancellationToken); + public Task Create(string route, long instanceId, CancellationToken cancellationToken) + => RunRequest(route, new object(), HttpMethod.Put, instanceId, false, cancellationToken); /// - public Task Patch(string route, long instanceId, CancellationToken cancellationToken) => RunRequest(route, new object(), HttpPatch, instanceId, false, cancellationToken); + public Task Patch(string route, long instanceId, CancellationToken cancellationToken) + => RunRequest(route, new object(), HttpPatch, instanceId, false, cancellationToken); /// public void AddRequestLogger(IRequestLogger requestLogger) => requestLoggers.Add(requestLogger ?? throw new ArgumentNullException(nameof(requestLogger))); diff --git a/src/Tgstation.Server.Client/ApiConflictException.cs b/src/Tgstation.Server.Client/ApiConflictException.cs index 02dd82ea94..52ec9b4eb2 100644 --- a/src/Tgstation.Server.Client/ApiConflictException.cs +++ b/src/Tgstation.Server.Client/ApiConflictException.cs @@ -15,7 +15,8 @@ namespace Tgstation.Server.Client /// /// The for the . /// The for the . - public ApiConflictException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) : base(errorMessage, responseMessage) + public ApiConflictException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) + : base(errorMessage, responseMessage) { } @@ -30,7 +31,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public ApiConflictException(string message) : base(message) + public ApiConflictException(string message) + : base(message) { } @@ -39,7 +41,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public ApiConflictException(string message, Exception innerException) : base(message, innerException) + public ApiConflictException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/ApiException.cs b/src/Tgstation.Server.Client/ApiException.cs index 3a90907254..f041a869cf 100644 --- a/src/Tgstation.Server.Client/ApiException.cs +++ b/src/Tgstation.Server.Client/ApiException.cs @@ -31,9 +31,10 @@ namespace Tgstation.Server.Client /// /// The returned from the API. /// The . - protected ApiException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) : base( - responseMessage, - errorMessage?.Message ?? $"HTTP {responseMessage?.StatusCode ?? throw new ArgumentNullException(nameof(responseMessage))}. Unknown API error, ErrorMessage payload not present!") + protected ApiException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) + : base( + responseMessage, + errorMessage?.Message ?? $"HTTP {responseMessage?.StatusCode ?? throw new ArgumentNullException(nameof(responseMessage))}. Unknown API error, ErrorMessage payload not present!") { ServerApiVersion = errorMessage?.ServerApiVersion; AdditionalServerData = errorMessage?.AdditionalData; @@ -45,9 +46,8 @@ namespace Tgstation.Server.Client /// /// The . /// The . - protected ApiException(HttpResponseMessage responseMessage, string message) : base( - responseMessage, - message) + protected ApiException(HttpResponseMessage responseMessage, string message) + : base(responseMessage, message) { } @@ -62,7 +62,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - protected ApiException(string message) : base(message) + protected ApiException(string message) + : base(message) { } @@ -71,7 +72,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - protected ApiException(string message, Exception innerException) : base(message, innerException) + protected ApiException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/ClientException.cs b/src/Tgstation.Server.Client/ClientException.cs index 4647f7bd43..7f2a119119 100644 --- a/src/Tgstation.Server.Client/ClientException.cs +++ b/src/Tgstation.Server.Client/ClientException.cs @@ -19,7 +19,8 @@ namespace Tgstation.Server.Client /// /// The that generated the . /// The message for the . - protected ClientException(HttpResponseMessage responseMessage, string message) : base(message) + protected ClientException(HttpResponseMessage responseMessage, string message) + : base(message) { ResponseMessage = responseMessage ?? throw new ArgumentNullException(nameof(responseMessage)); } @@ -35,7 +36,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - protected ClientException(string message) : base(message) + protected ClientException(string message) + : base(message) { } @@ -44,7 +46,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - protected ClientException(string message, Exception innerException) : base(message, innerException) + protected ClientException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/ConflictException.cs b/src/Tgstation.Server.Client/ConflictException.cs index 7e18a1515b..54882788a4 100644 --- a/src/Tgstation.Server.Client/ConflictException.cs +++ b/src/Tgstation.Server.Client/ConflictException.cs @@ -15,7 +15,8 @@ namespace Tgstation.Server.Client /// /// The for the . /// The for the . - public ConflictException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) : base(errorMessage, responseMessage) + public ConflictException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) + : base(errorMessage, responseMessage) { } @@ -30,7 +31,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public ConflictException(string message) : base(message) + public ConflictException(string message) + : base(message) { } @@ -39,7 +41,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public ConflictException(string message, Exception innerException) : base(message, innerException) + public ConflictException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/IApiClient.cs b/src/Tgstation.Server.Client/IApiClient.cs index 7758e9aefe..b60b534efb 100644 --- a/src/Tgstation.Server.Client/IApiClient.cs +++ b/src/Tgstation.Server.Client/IApiClient.cs @@ -44,7 +44,8 @@ namespace Tgstation.Server.Client /// The request body. /// The for the operation. /// A resulting in the response body as a . - Task Create(string route, TBody body, CancellationToken cancellationToken) where TBody : class; + Task Create(string route, TBody body, CancellationToken cancellationToken) + where TBody : class; /// /// Run an HTTP PUT request. @@ -73,7 +74,8 @@ namespace Tgstation.Server.Client /// The request body. /// The for the operation. /// A resulting in the response body as a . - Task Update(string route, TBody body, CancellationToken cancellationToken) where TBody : class; + Task Update(string route, TBody body, CancellationToken cancellationToken) + where TBody : class; /// /// Run an HTTP POST request. @@ -92,7 +94,8 @@ namespace Tgstation.Server.Client /// The request body. /// The for the operation. /// A representing the running operation. - Task Update(string route, TBody body, CancellationToken cancellationToken) where TBody : class; + Task Update(string route, TBody body, CancellationToken cancellationToken) + where TBody : class; /// /// Run an HTTP PATCH request. @@ -192,7 +195,8 @@ namespace Tgstation.Server.Client /// The instance to make the request to. /// The for the operation. /// A representing the running operation. - Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class; + Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) + where TBody : class; /// /// Run an HTTP DELETE request. @@ -214,7 +218,8 @@ namespace Tgstation.Server.Client /// The instance to make the request to. /// The for the operation. /// A representing the running operation. - Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class; + Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) + where TBody : class; /// /// Downloads a file for a given . diff --git a/src/Tgstation.Server.Client/InsufficientPermissionsException.cs b/src/Tgstation.Server.Client/InsufficientPermissionsException.cs index 76f7259ea4..b6d0483007 100644 --- a/src/Tgstation.Server.Client/InsufficientPermissionsException.cs +++ b/src/Tgstation.Server.Client/InsufficientPermissionsException.cs @@ -12,9 +12,10 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The for the . - public InsufficientPermissionsException(HttpResponseMessage responseMessage) : base( - responseMessage, - "The current user has insufficient permissions to perform the requested operation!") + public InsufficientPermissionsException(HttpResponseMessage responseMessage) + : base( + responseMessage, + "The current user has insufficient permissions to perform the requested operation!") { } @@ -29,7 +30,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public InsufficientPermissionsException(string message) : base(message) + public InsufficientPermissionsException(string message) + : base(message) { } @@ -38,7 +40,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public InsufficientPermissionsException(string message, Exception innerException) : base(message, innerException) + public InsufficientPermissionsException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/MethodNotSupportedException.cs b/src/Tgstation.Server.Client/MethodNotSupportedException.cs index 88a708bba4..c20a3c41ce 100644 --- a/src/Tgstation.Server.Client/MethodNotSupportedException.cs +++ b/src/Tgstation.Server.Client/MethodNotSupportedException.cs @@ -15,7 +15,8 @@ namespace Tgstation.Server.Client /// /// The for the . /// The for the . - public MethodNotSupportedException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) : base(errorMessage, responseMessage) + public MethodNotSupportedException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) + : base(errorMessage, responseMessage) { } @@ -30,7 +31,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public MethodNotSupportedException(string message) : base(message) + public MethodNotSupportedException(string message) + : base(message) { } @@ -39,7 +41,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public MethodNotSupportedException(string message, Exception innerException) : base(message, innerException) + public MethodNotSupportedException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/RateLimitException.cs b/src/Tgstation.Server.Client/RateLimitException.cs index e4caf6bb9c..55ad10862a 100644 --- a/src/Tgstation.Server.Client/RateLimitException.cs +++ b/src/Tgstation.Server.Client/RateLimitException.cs @@ -23,7 +23,8 @@ namespace Tgstation.Server.Client /// /// The for the . /// The for the . - public RateLimitException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) : base(errorMessage, responseMessage) + public RateLimitException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) + : base(errorMessage, responseMessage) { if (responseMessage == null) throw new ArgumentNullException(nameof(responseMessage)); @@ -47,7 +48,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public RateLimitException(string message) : base(message) + public RateLimitException(string message) + : base(message) { } @@ -56,7 +58,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public RateLimitException(string message, Exception innerException) : base(message, innerException) + public RateLimitException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/RequestTimeoutException.cs b/src/Tgstation.Server.Client/RequestTimeoutException.cs index 7d24457bd5..922f4015c9 100644 --- a/src/Tgstation.Server.Client/RequestTimeoutException.cs +++ b/src/Tgstation.Server.Client/RequestTimeoutException.cs @@ -12,7 +12,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The for the . - public RequestTimeoutException(HttpResponseMessage responseMessage) : base(responseMessage, "The request timed out!") + public RequestTimeoutException(HttpResponseMessage responseMessage) + : base(responseMessage, "The request timed out!") { } @@ -27,7 +28,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public RequestTimeoutException(string message) : base(message) + public RequestTimeoutException(string message) + : base(message) { } @@ -36,7 +38,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public RequestTimeoutException(string message, Exception innerException) : base(message, innerException) + public RequestTimeoutException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/ServerErrorException.cs b/src/Tgstation.Server.Client/ServerErrorException.cs index 805b797440..aae91e2d13 100644 --- a/src/Tgstation.Server.Client/ServerErrorException.cs +++ b/src/Tgstation.Server.Client/ServerErrorException.cs @@ -22,7 +22,8 @@ namespace Tgstation.Server.Client /// /// The for the . /// The for the . - public ServerErrorException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) : base(errorMessage, responseMessage) + public ServerErrorException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) + : base(errorMessage, responseMessage) { } @@ -30,7 +31,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public ServerErrorException(string message) : base(message) + public ServerErrorException(string message) + : base(message) { } @@ -39,7 +41,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public ServerErrorException(string message, Exception innerException) : base(message, innerException) + public ServerErrorException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/ServiceUnavailableException.cs b/src/Tgstation.Server.Client/ServiceUnavailableException.cs index fb2ae62c28..f26300ccd7 100644 --- a/src/Tgstation.Server.Client/ServiceUnavailableException.cs +++ b/src/Tgstation.Server.Client/ServiceUnavailableException.cs @@ -12,7 +12,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The . - public ServiceUnavailableException(HttpResponseMessage responseMessage) : base(responseMessage, "The service is unavailable!") + public ServiceUnavailableException(HttpResponseMessage responseMessage) + : base(responseMessage, "The service is unavailable!") { } @@ -27,7 +28,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public ServiceUnavailableException(string message) : base(message) + public ServiceUnavailableException(string message) + : base(message) { } @@ -36,7 +38,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public ServiceUnavailableException(string message, Exception innerException) : base(message, innerException) + public ServiceUnavailableException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/UnauthorizedException.cs b/src/Tgstation.Server.Client/UnauthorizedException.cs index 7a1ad6753b..f7ac53494e 100644 --- a/src/Tgstation.Server.Client/UnauthorizedException.cs +++ b/src/Tgstation.Server.Client/UnauthorizedException.cs @@ -15,7 +15,8 @@ namespace Tgstation.Server.Client /// /// The returned by the API. /// The . - public UnauthorizedException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) : base(errorMessage, responseMessage) + public UnauthorizedException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) + : base(errorMessage, responseMessage) { } @@ -30,7 +31,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public UnauthorizedException(string message) : base(message) + public UnauthorizedException(string message) + : base(message) { } @@ -39,7 +41,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public UnauthorizedException(string message, Exception innerException) : base(message, innerException) + public UnauthorizedException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/UnrecognizedResponseException.cs b/src/Tgstation.Server.Client/UnrecognizedResponseException.cs index 30e09da8d0..515c1148ec 100644 --- a/src/Tgstation.Server.Client/UnrecognizedResponseException.cs +++ b/src/Tgstation.Server.Client/UnrecognizedResponseException.cs @@ -12,7 +12,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The . - public UnrecognizedResponseException(HttpResponseMessage responseMessage) : base(responseMessage, "Unrecognized response body!") + public UnrecognizedResponseException(HttpResponseMessage responseMessage) + : base(responseMessage, "Unrecognized response body!") { } @@ -27,7 +28,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public UnrecognizedResponseException(string message) : base(message) + public UnrecognizedResponseException(string message) + : base(message) { } @@ -36,7 +38,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public UnrecognizedResponseException(string message, Exception innerException) : base(message, innerException) + public UnrecognizedResponseException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Client/VersionMismatchException.cs b/src/Tgstation.Server.Client/VersionMismatchException.cs index e6fe4edf9c..0f9a71d3c9 100644 --- a/src/Tgstation.Server.Client/VersionMismatchException.cs +++ b/src/Tgstation.Server.Client/VersionMismatchException.cs @@ -15,7 +15,8 @@ namespace Tgstation.Server.Client /// /// The for the . /// The for the . - public VersionMismatchException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) : base(errorMessage, responseMessage) + public VersionMismatchException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage) + : base(errorMessage, responseMessage) { } @@ -30,7 +31,8 @@ namespace Tgstation.Server.Client /// Initializes a new instance of the class. /// /// The message for the . - public VersionMismatchException(string message) : base(message) + public VersionMismatchException(string message) + : base(message) { } @@ -39,7 +41,8 @@ namespace Tgstation.Server.Client /// /// The message for the . /// The inner for the base . - public VersionMismatchException(string message, Exception innerException) : base(message, innerException) + public VersionMismatchException(string message, Exception innerException) + : base(message, innerException) { } } diff --git a/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs b/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs index 6a70782af1..fea0be66e5 100644 --- a/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs +++ b/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs @@ -11,7 +11,6 @@ using Microsoft.Extensions.Logging; using Tgstation.Server.Api.Models; using Tgstation.Server.Host.Components.Events; -using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Jobs; using Tgstation.Server.Host.Utils; diff --git a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs index b8038dfe5b..38c561650b 100644 --- a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs +++ b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs @@ -14,7 +14,6 @@ using Tgstation.Server.Host.Components.Chat.Commands; using Tgstation.Server.Host.Components.Chat.Providers; using Tgstation.Server.Host.Components.Interop; using Tgstation.Server.Host.Core; -using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.Utils; namespace Tgstation.Server.Host.Components.Chat diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs index 6cc52173d9..35840d67db 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/Provider.cs @@ -7,7 +7,6 @@ using Microsoft.Extensions.Logging; using Tgstation.Server.Api.Rights; using Tgstation.Server.Host.Components.Interop; -using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.Jobs; using Tgstation.Server.Host.Models; using Tgstation.Server.Host.Utils; diff --git a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs index 611b03ec13..ba13695c45 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs @@ -18,7 +18,6 @@ using Tgstation.Server.Host.Components.Repository; using Tgstation.Server.Host.Components.Session; using Tgstation.Server.Host.Configuration; using Tgstation.Server.Host.Database; -using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Jobs; using Tgstation.Server.Host.Models; diff --git a/src/Tgstation.Server.Host/Components/Interop/Bridge/TestMergeInformation.cs b/src/Tgstation.Server.Host/Components/Interop/Bridge/TestMergeInformation.cs index ee8a96f7c7..1270af68cf 100644 --- a/src/Tgstation.Server.Host/Components/Interop/Bridge/TestMergeInformation.cs +++ b/src/Tgstation.Server.Host/Components/Interop/Bridge/TestMergeInformation.cs @@ -37,7 +37,8 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge /// /// The to build from. /// The value of . - public TestMergeInformation(Models.TestMerge testMerge, RevisionInformation revision) : base(testMerge) + public TestMergeInformation(Models.TestMerge testMerge, RevisionInformation revision) + : base(testMerge) { TimeMerged = testMerge?.MergedAt.Ticks.ToString(CultureInfo.InvariantCulture) ?? throw new ArgumentNullException(nameof(testMerge)); Revision = revision ?? throw new ArgumentNullException(nameof(revision)); diff --git a/src/Tgstation.Server.Host/Components/Repository/GitLabRemoteFeatures.cs b/src/Tgstation.Server.Host/Components/Repository/GitLabRemoteFeatures.cs index 166383353f..236c125112 100644 --- a/src/Tgstation.Server.Host/Components/Repository/GitLabRemoteFeatures.cs +++ b/src/Tgstation.Server.Host/Components/Repository/GitLabRemoteFeatures.cs @@ -7,7 +7,6 @@ using Microsoft.Extensions.Logging; using Tgstation.Server.Api.Models; using Tgstation.Server.Api.Models.Internal; -using Tgstation.Server.Host.Extensions; namespace Tgstation.Server.Host.Components.Repository { diff --git a/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs b/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs index c575f7a2e1..2c9007f4f3 100644 --- a/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs +++ b/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs @@ -48,7 +48,8 @@ namespace Tgstation.Server.Host.Components.Session Models.ReattachInformation copy, IDmbProvider dmb, IDmbProvider initialDmb, - TimeSpan topicRequestTimeout) : base(copy) + TimeSpan topicRequestTimeout) + : base(copy) { Dmb = dmb ?? throw new ArgumentNullException(nameof(dmb)); InitialDmb = initialDmb; diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 4a8bb4a152..cada7d1b6c 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -284,7 +284,8 @@ namespace Tgstation.Server.Host.Core services.AddHttpClient(); services.AddSingleton(); - void AddTypedContext() where TContext : DatabaseContext + void AddTypedContext() + where TContext : DatabaseContext { var configureAction = DatabaseContext.GetConfigureAction(); diff --git a/src/Tgstation.Server.Host/Core/CommandPipeReader.cs b/src/Tgstation.Server.Host/Core/CommandPipeReader.cs index 61bad2b474..54f365ab65 100644 --- a/src/Tgstation.Server.Host/Core/CommandPipeReader.cs +++ b/src/Tgstation.Server.Host/Core/CommandPipeReader.cs @@ -10,7 +10,6 @@ using Microsoft.Extensions.Options; using Tgstation.Server.Host.Common; using Tgstation.Server.Host.Configuration; -using Tgstation.Server.Host.Extensions; namespace Tgstation.Server.Host.Core { diff --git a/src/Tgstation.Server.Host/Database/DatabaseCollection.cs b/src/Tgstation.Server.Host/Database/DatabaseCollection.cs index 78e745390e..b2dafa719d 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseCollection.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseCollection.cs @@ -10,7 +10,8 @@ using Microsoft.EntityFrameworkCore; namespace Tgstation.Server.Host.Database { /// - sealed class DatabaseCollection : IDatabaseCollection where TModel : class + sealed class DatabaseCollection : IDatabaseCollection + where TModel : class { /// /// The backing . diff --git a/src/Tgstation.Server.Host/Database/DatabaseContext.cs b/src/Tgstation.Server.Host/Database/DatabaseContext.cs index 5ba4b53d08..c4d3fadbd0 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseContext.cs @@ -255,7 +255,8 @@ namespace Tgstation.Server.Host.Database /// Initializes a new instance of the class. /// /// The for the . - protected DatabaseContext(DbContextOptions dbContextOptions) : base(dbContextOptions) + protected DatabaseContext(DbContextOptions dbContextOptions) + : base(dbContextOptions) { usersCollection = new DatabaseCollection(Users); instancesCollection = new DatabaseCollection(Instances); diff --git a/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs b/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs index d9d005a846..83d109c425 100644 --- a/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs @@ -22,7 +22,8 @@ namespace Tgstation.Server.Host.Database /// Initializes a new instance of the class. /// /// The for the . - public MySqlDatabaseContext(DbContextOptions dbContextOptions) : base(dbContextOptions) + public MySqlDatabaseContext(DbContextOptions dbContextOptions) + : base(dbContextOptions) { } diff --git a/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs b/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs index a5b5d2319a..33cab94dcf 100644 --- a/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/SqlServerDatabaseContext.cs @@ -16,7 +16,8 @@ namespace Tgstation.Server.Host.Database /// Initializes a new instance of the class. /// /// The for the . - public SqlServerDatabaseContext(DbContextOptions dbContextOptions) : base(dbContextOptions) + public SqlServerDatabaseContext(DbContextOptions dbContextOptions) + : base(dbContextOptions) { } diff --git a/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs b/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs index 5acfd9abb3..c4d7e029b5 100644 --- a/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs @@ -56,7 +56,8 @@ namespace Tgstation.Server.Host.Extensions /// Change the used as an implementation for calls to . /// /// The implementation to use. - public static void UseChatProviderFactory() where TProviderFactory : IProviderFactory + public static void UseChatProviderFactory() + where TProviderFactory : IProviderFactory { chatProviderFactoryType = typeof(TProviderFactory); } @@ -65,7 +66,8 @@ namespace Tgstation.Server.Host.Extensions /// Change the used as an implementation for calls to . /// /// The implementation to use. - public static void UseGitHubServiceFactory() where TGitHubServiceFactory : IGitHubServiceFactory + public static void UseGitHubServiceFactory() + where TGitHubServiceFactory : IGitHubServiceFactory { gitHubServiceFactoryType = typeof(TGitHubServiceFactory); } @@ -74,7 +76,8 @@ namespace Tgstation.Server.Host.Extensions /// Change the used as an implementation for calls to . /// /// The implementation to use. - public static void UseFileDownloader() where TFileDownloader : IFileDownloader + public static void UseFileDownloader() + where TFileDownloader : IFileDownloader { fileDownloaderType = typeof(TFileDownloader); } @@ -112,7 +115,8 @@ namespace Tgstation.Server.Host.Extensions /// Add an additional to s that call . /// /// The of to add. - public static void UseAdditionalLoggerProvider() where TLoggerProvider : class, ILoggerProvider + public static void UseAdditionalLoggerProvider() + where TLoggerProvider : class, ILoggerProvider { if (additionalLoggerProvider != null) throw new InvalidOperationException("Cannot have multiple additionalLoggerProviders!"); @@ -138,7 +142,8 @@ namespace Tgstation.Server.Host.Extensions /// The to configure. /// The containing the . /// . - public static IServiceCollection UseStandardConfig(this IServiceCollection serviceCollection, IConfiguration configuration) where TConfig : class + public static IServiceCollection UseStandardConfig(this IServiceCollection serviceCollection, IConfiguration configuration) + where TConfig : class { ArgumentNullException.ThrowIfNull(serviceCollection); ArgumentNullException.ThrowIfNull(configuration); diff --git a/src/Tgstation.Server.Host/IO/DefaultIOManager.cs b/src/Tgstation.Server.Host/IO/DefaultIOManager.cs index fd01d2aa38..5da2cc8b8c 100644 --- a/src/Tgstation.Server.Host/IO/DefaultIOManager.cs +++ b/src/Tgstation.Server.Host/IO/DefaultIOManager.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.Utils; namespace Tgstation.Server.Host.IO diff --git a/src/Tgstation.Server.Host/Jobs/JobException.cs b/src/Tgstation.Server.Host/Jobs/JobException.cs index ccb1234559..0eb62f2e29 100644 --- a/src/Tgstation.Server.Host/Jobs/JobException.cs +++ b/src/Tgstation.Server.Host/Jobs/JobException.cs @@ -25,7 +25,8 @@ namespace Tgstation.Server.Host.Jobs /// Initializes a new instance of the class. /// /// The message for the . - public JobException(string message) : base(message) + public JobException(string message) + : base(message) { } @@ -34,7 +35,8 @@ namespace Tgstation.Server.Host.Jobs /// /// The message for the . /// The inner for the nase . - public JobException(string message, Exception innerException) : base(message, innerException) + public JobException(string message, Exception innerException) + : base(message, innerException) { } @@ -42,7 +44,8 @@ namespace Tgstation.Server.Host.Jobs /// Initializes a new instance of the class. /// /// The associated . - public JobException(ErrorCode errorCode) : base(errorCode.Describe()) + public JobException(ErrorCode errorCode) + : base(errorCode.Describe()) { ErrorCode = errorCode; } @@ -52,7 +55,8 @@ namespace Tgstation.Server.Host.Jobs /// /// The associated . /// The inner for the nase . - public JobException(ErrorCode errorCode, Exception innerException) : base(errorCode.Describe(), innerException) + public JobException(ErrorCode errorCode, Exception innerException) + : base(errorCode.Describe(), innerException) { ErrorCode = errorCode; } diff --git a/src/Tgstation.Server.Host/Jobs/JobHandler.cs b/src/Tgstation.Server.Host/Jobs/JobHandler.cs index 1bf64380f4..57aae60fdb 100644 --- a/src/Tgstation.Server.Host/Jobs/JobHandler.cs +++ b/src/Tgstation.Server.Host/Jobs/JobHandler.cs @@ -2,8 +2,6 @@ using System.Threading; using System.Threading.Tasks; -using Tgstation.Server.Host.Extensions; - namespace Tgstation.Server.Host.Jobs { /// diff --git a/src/Tgstation.Server.Host/Security/AuthenticationContext.cs b/src/Tgstation.Server.Host/Security/AuthenticationContext.cs index 510a882004..105c7f9837 100644 --- a/src/Tgstation.Server.Host/Security/AuthenticationContext.cs +++ b/src/Tgstation.Server.Host/Security/AuthenticationContext.cs @@ -69,7 +69,7 @@ namespace Tgstation.Server.Host.Security var prop = typeToCheck.GetProperties().Where(x => x.PropertyType == nullableRightsType).First(); - var right = prop.GetMethod.Invoke(isInstance ? (object)InstancePermissionSet : PermissionSet, Array.Empty()); + var right = prop.GetMethod.Invoke(isInstance ? InstancePermissionSet : PermissionSet, Array.Empty()); if (right == null) throw new InvalidOperationException("A user right was null!"); diff --git a/src/Tgstation.Server.Host/System/AssemblyInformationProvider.cs b/src/Tgstation.Server.Host/System/AssemblyInformationProvider.cs index ccbb2643f5..34d2a9a940 100644 --- a/src/Tgstation.Server.Host/System/AssemblyInformationProvider.cs +++ b/src/Tgstation.Server.Host/System/AssemblyInformationProvider.cs @@ -4,7 +4,6 @@ using System.Reflection; using Tgstation.Server.Common; using Tgstation.Server.Common.Extensions; -using Tgstation.Server.Host.Common; namespace Tgstation.Server.Host.System { diff --git a/src/Tgstation.Server.Host/System/ProcessExecutor.cs b/src/Tgstation.Server.Host/System/ProcessExecutor.cs index af4f01c421..b4521c18c2 100644 --- a/src/Tgstation.Server.Host/System/ProcessExecutor.cs +++ b/src/Tgstation.Server.Host/System/ProcessExecutor.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.IO; namespace Tgstation.Server.Host.System diff --git a/src/Tgstation.Server.Host/System/SystemDManager.cs b/src/Tgstation.Server.Host/System/SystemDManager.cs index d7b852ae58..1eaeafbc84 100644 --- a/src/Tgstation.Server.Host/System/SystemDManager.cs +++ b/src/Tgstation.Server.Host/System/SystemDManager.cs @@ -10,7 +10,6 @@ using Mono.Unix; using Tgstation.Server.Host.Components; using Tgstation.Server.Host.Core; -using Tgstation.Server.Host.Extensions; namespace Tgstation.Server.Host.System { diff --git a/src/Tgstation.Server.Host/Transfer/FileTransferService.cs b/src/Tgstation.Server.Host/Transfer/FileTransferService.cs index eabb99e445..22dee33c7c 100644 --- a/src/Tgstation.Server.Host/Transfer/FileTransferService.cs +++ b/src/Tgstation.Server.Host/Transfer/FileTransferService.cs @@ -8,7 +8,6 @@ using Microsoft.Extensions.Logging; using Tgstation.Server.Api.Models; using Tgstation.Server.Api.Models.Response; -using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Security; using Tgstation.Server.Host.Utils; diff --git a/src/Tgstation.Server.Host/Transfer/FileUploadProvider.cs b/src/Tgstation.Server.Host/Transfer/FileUploadProvider.cs index af3ad3229f..69286cc52c 100644 --- a/src/Tgstation.Server.Host/Transfer/FileUploadProvider.cs +++ b/src/Tgstation.Server.Host/Transfer/FileUploadProvider.cs @@ -7,7 +7,6 @@ using Microsoft.AspNetCore.WebUtilities; using Tgstation.Server.Api.Models; using Tgstation.Server.Api.Models.Response; -using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.IO; namespace Tgstation.Server.Host.Transfer diff --git a/tools/Tgstation.Server.Migrator.Comms/Program.cs b/tools/Tgstation.Server.Migrator.Comms/Program.cs index 8cebd477c7..ef3be285bf 100644 --- a/tools/Tgstation.Server.Migrator.Comms/Program.cs +++ b/tools/Tgstation.Server.Migrator.Comms/Program.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http.Headers;