-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional code analyzers (#303)
* Added Meziantou.Analyzer * Added Roslynator.Analyzers * Added the remaining analyzers
- Loading branch information
Showing
172 changed files
with
1,496 additions
and
1,249 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
src/NKZSoft.Template.Application/Common/Behaviours/LoggingBehaviour.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
namespace NKZSoft.Template.Application.Common.Behaviours; | ||
|
||
using Interfaces; | ||
using NKZSoft.Template.Common.Extensions; | ||
|
||
public sealed class LoggingBehaviour<TRequest> : IRequestPreProcessor<TRequest> where TRequest : notnull | ||
{ | ||
private readonly ILogger _logger; | ||
|
||
public LoggingBehaviour(ILogger<LoggingBehaviour<TRequest>> logger, ICurrentUserService currentUserService) => _logger = logger.ThrowIfNull(); | ||
public LoggingBehaviour(ILogger<LoggingBehaviour<TRequest>> logger) => _logger = logger.ThrowIfNull(); | ||
|
||
public async Task Process(TRequest request, CancellationToken cancellationToken) | ||
{ | ||
_logger.LoggingRequest(request.ToString()); | ||
await Task.CompletedTask; | ||
await Task.CompletedTask.ConfigureAwait(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
src/NKZSoft.Template.Application/Common/Exceptions/AuthorizationException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
namespace NKZSoft.Template.Application.Common.Exceptions; | ||
|
||
[Serializable] | ||
public sealed class AuthorizationException(string message) : Exception(message); | ||
public sealed class AuthorizationException : Exception | ||
{ | ||
public AuthorizationException() | ||
{ | ||
} | ||
|
||
public AuthorizationException(string? message) : base(message) | ||
{ | ||
} | ||
|
||
public AuthorizationException(string? message, Exception? innerException) : base(message, innerException) | ||
{ | ||
} | ||
} |
15 changes: 14 additions & 1 deletion
15
src/NKZSoft.Template.Application/Common/Exceptions/BadRequestException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
namespace NKZSoft.Template.Application.Common.Exceptions; | ||
|
||
[Serializable] | ||
public sealed class BadRequestException(string message) : Exception(message); | ||
public sealed class BadRequestException : Exception | ||
{ | ||
public BadRequestException() | ||
{ | ||
} | ||
|
||
public BadRequestException(string? message) : base(message) | ||
{ | ||
} | ||
|
||
public BadRequestException(string? message, Exception? innerException) : base(message, innerException) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 19 additions & 2 deletions
21
src/NKZSoft.Template.Application/Common/Exceptions/DeleteFailureException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
namespace NKZSoft.Template.Application.Common.Exceptions; | ||
|
||
[Serializable] | ||
public sealed class DeleteFailureException(string name, object key, string message) | ||
: Exception($"Deletion of entity \"{name}\" ({key}) failed. {message}"); | ||
public sealed class DeleteFailureException : Exception | ||
{ | ||
public DeleteFailureException(string name, object key, string message) | ||
: base($"Deletion of entity \"{name}\" ({key}) failed. {message}") | ||
{ | ||
} | ||
|
||
public DeleteFailureException() | ||
{ | ||
} | ||
|
||
public DeleteFailureException(string? message) : base(message) | ||
{ | ||
} | ||
|
||
public DeleteFailureException(string? message, Exception? innerException) : base(message, innerException) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
public sealed class NotFoundException : Exception | ||
{ | ||
public NotFoundException() | ||
: base() | ||
{ | ||
} | ||
|
||
|
15 changes: 14 additions & 1 deletion
15
src/NKZSoft.Template.Application/Common/Exceptions/PermissionDeniedException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
namespace NKZSoft.Template.Application.Common.Exceptions; | ||
|
||
[Serializable] | ||
public sealed class PermissionDeniedException(string message) : Exception(message); | ||
public sealed class PermissionDeniedException : Exception | ||
{ | ||
public PermissionDeniedException() | ||
{ | ||
} | ||
|
||
public PermissionDeniedException(string? message) : base(message) | ||
{ | ||
} | ||
|
||
public PermissionDeniedException(string? message, Exception? innerException) : base(message, innerException) | ||
{ | ||
} | ||
} |
17 changes: 14 additions & 3 deletions
17
src/NKZSoft.Template.Application/Common/Exceptions/UnauthorizedException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
namespace NKZSoft.Template.Application.Common.Exceptions; | ||
|
||
[Serializable] | ||
public sealed class UnauthorizedException(string message) : Exception(message) | ||
public sealed class UnauthorizedException : Exception | ||
{ | ||
public static UnauthorizedException Response(string message) | ||
=> new UnauthorizedException(message); | ||
public UnauthorizedException() | ||
{ | ||
} | ||
|
||
public UnauthorizedException(string? message) : base(message) | ||
{ | ||
} | ||
|
||
public UnauthorizedException(string? message, Exception? innerException) : base(message, innerException) | ||
{ | ||
} | ||
|
||
public static UnauthorizedException Response(string message) => new(message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
...mmon/Filters/FilterDefinitionExtension.cs → ...mon/Filters/FilterDefinitionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
namespace NKZSoft.Template.Application.Common.Filters; | ||
|
||
public static class FilterDefinitionExtension | ||
public static class FilterDefinitionExtensions | ||
{ | ||
public static bool HasValue<T>([NotNullWhen(true)] this FilterFieldDefinition<T>? testValue) | ||
{ | ||
return testValue switch | ||
public static bool HasValue<T>([NotNullWhen(true)] this FilterFieldDefinition<T>? testValue) => | ||
testValue switch | ||
{ | ||
null => false, | ||
FilterFieldDefinition<string> stringValue => !string.IsNullOrEmpty(stringValue.Value), | ||
var nullableValue => nullableValue.Value != null | ||
var nullableValue => nullableValue.Value is not null, | ||
}; | ||
} | ||
} |
7 changes: 2 additions & 5 deletions
7
src/NKZSoft.Template.Application/Common/Mappings/AppCodeGenerationRegister.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
public enum EnumSortDirection : byte | ||
{ | ||
None, | ||
Asc, | ||
Desc | ||
None = 0, | ||
Asc = 1, | ||
Desc = 2, | ||
} |
Oops, something went wrong.