diff --git a/.editorconfig b/.editorconfig index 45733f036..7cc5dd8c0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,7 +8,7 @@ root = true # Enforce line endings to be LF end_of_line = lf # Enforce indentation to be 4 spaces -indent_style = spaces +indent_style = space indent_size = 4 # Insert a final new line at the end of the file insert_final_newline = true @@ -31,7 +31,7 @@ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity # Enforce file scoped namespaces csharp_style_namespace_declarations = file_scoped:suggestion # Place 'using' directives outside of namespaces -csharp_using_directive_placement = outside_namespace:true +csharp_using_directive_placement = outside_namespace # Disabling this because of https://github.com/dotnet/roslyn/issues/41640 dotnet_diagnostic.IDE0005.severity = none @@ -69,5 +69,4 @@ dotnet_diagnostic.CA2208.severity = suggestion [*.yml] # Enforce indentation to be 2 spaces -indent_style = spaces indent_size = 2 \ No newline at end of file diff --git a/src/Digdir.Domain.Dialogporten.Application/Common/Extensions/ClaimsPrincipalExtensions.cs b/src/Digdir.Domain.Dialogporten.Application/Common/Extensions/ClaimsPrincipalExtensions.cs index 4ef0ac234..cd57dc633 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Common/Extensions/ClaimsPrincipalExtensions.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Common/Extensions/ClaimsPrincipalExtensions.cs @@ -67,7 +67,7 @@ public static bool TryGetOrgNumber(this Claim? consumerClaim, [NotNullWhen(true) orgNumber = id.Split(IdDelimiter) switch { - [IdPrefix, var on] => NorwegianOrganizationIdentifier.IsValid(on) ? on : null, + [IdPrefix, var on] => NorwegianOrganizationIdentifier.IsValid(on) ? on : null, _ => null }; diff --git a/src/Digdir.Domain.Dialogporten.Application/Common/Pagination/Continuation/ContinuationTokenSet.cs b/src/Digdir.Domain.Dialogporten.Application/Common/Pagination/Continuation/ContinuationTokenSet.cs index dfd91eac8..8cdcffb0f 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Common/Pagination/Continuation/ContinuationTokenSet.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Common/Pagination/Continuation/ContinuationTokenSet.cs @@ -37,10 +37,9 @@ public static bool TryParse(string? value, out ContinuationTokenSet x.Split(PaginationConstants.ContinuationTokenDelimiter, StringSplitOptions.TrimEntries) switch { - [var key, var ctAsString] - when OrderOptions.Value.TryGetSelector(key, out var option) - && TryParseExtensions.TryParse(option.Body.Type, ctAsString, out var ct) - => new ContinuationToken(key, ct, option.Body.Type), + [var key, var ctAsString] + when OrderOptions.Value.TryGetSelector(key, out var option) + && TryParseExtensions.TryParse(option.Body.Type, ctAsString, out var ct) => new ContinuationToken(key, ct, option.Body.Type), _ => null }); @@ -73,9 +72,6 @@ public bool Equals(ContinuationToken? x, ContinuationToken? y) return x.Key == y.Key; } - public int GetHashCode([DisallowNull] ContinuationToken obj) - { - return obj.Key.GetHashCode(); - } + public int GetHashCode([DisallowNull] ContinuationToken obj) => obj.Key.GetHashCode(); } -} \ No newline at end of file +} diff --git a/src/Digdir.Domain.Dialogporten.Application/Common/Pagination/OrderOption/IOrderOptions.cs b/src/Digdir.Domain.Dialogporten.Application/Common/Pagination/OrderOption/IOrderOptions.cs index 6b689798b..bebbb7a73 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Common/Pagination/OrderOption/IOrderOptions.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Common/Pagination/OrderOption/IOrderOptions.cs @@ -43,16 +43,15 @@ public bool TryParseOrder(string? value, [NotNullWhen(true)] out Order? result = value.Split(PaginationConstants.OrderDelimiter, StringSplitOptions.TrimEntries) switch { - // eks: createdAt - [var key] - when _optionByKey.TryGetValue(key, out var expression) - => new(key, expression), - - // eks: createdAt_desc - [var key, var direction] - when _optionByKey.TryGetValue(key, out var expression) - && Enum.TryParse(direction, ignoreCase: true, out var dirEnum) - => new(key, expression, dirEnum), + // eks: createdAt + [var key] + when _optionByKey.TryGetValue(key, out var expression) + => new(key, expression), + // eks: createdAt_desc + [var key, var direction] + when _optionByKey.TryGetValue(key, out var expression) + && Enum.TryParse(direction, ignoreCase: true, out var dirEnum) + => new(key, expression, dirEnum), _ => null }; diff --git a/src/Digdir.Domain.Dialogporten.Infrastructure/UnitOfWork.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/UnitOfWork.cs index 88c7ecf97..48a8d78ba 100644 --- a/src/Digdir.Domain.Dialogporten.Infrastructure/UnitOfWork.cs +++ b/src/Digdir.Domain.Dialogporten.Infrastructure/UnitOfWork.cs @@ -96,7 +96,7 @@ public async Task SaveChangesAsync(CancellationToken cancella if (!_enableConcurrencyCheck) { // Attempt to save changes without concurrency check - await ConcurrencyRetryPolicy.ExecuteAsync(ct => _dialogDbContext.SaveChangesAsync(ct), cancellationToken); + await ConcurrencyRetryPolicy.ExecuteAsync(_dialogDbContext.SaveChangesAsync, cancellationToken); return new Success(); }