diff --git a/.editorconfig b/.editorconfig index acdfe414..eacb368f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -399,6 +399,7 @@ dotnet_naming_rule.parameters_rule.severity = warning # Microsoft - Code Analysis # https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ +dotnet_diagnostic.CA1515.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1515.md dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md dotnet_diagnostic.CA2007.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md @@ -416,8 +417,11 @@ dotnet_diagnostic.S3875.severity = none # Remove this overload of 'operato # Visual Studio dotnet_diagnostic.IDE0005.severity = none # IDE0005: Using directive is unnecessary +dotnet_diagnostic.IDE0021.severity = suggestion # IDE0021: Use expression body for constructor +dotnet_diagnostic.IDE0022.severity = suggestion # IDE0022: Use expression body for method dotnet_diagnostic.IDE0058.severity = none # IDE0058: Expression value is never used dotnet_diagnostic.IDE0079.severity = warning # IDE0079: Remove unnecessary suppression +dotnet_diagnostic.IDE0290.severity = none # IDE0290: Use primary constructor # AsyncFixer diff --git a/src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs b/src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs index 9f677125..1000019f 100644 --- a/src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs +++ b/src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs @@ -22,14 +22,12 @@ public CachedRepository(IRepository repository, IMemoryCache memoryCache) public ValueTask PerformHealthCheckAsync() => repository.PerformHealthCheckAsync(); - public async ValueTask GetByIdAsync(string id) - { - return await memoryCache.GetOrCreateAsync(id, async entry => + public async ValueTask GetByIdAsync(string id) => + await memoryCache.GetOrCreateAsync(id, async entry => { entry.SlidingExpiration = TimeSpan.FromDays(7); return await repository.GetByIdAsync(id); }); - } public async ValueTask> GetAllAsync( Expression> filter = null, diff --git a/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewModel.cs b/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewModel.cs index df6f3749..f5594742 100644 --- a/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewModel.cs +++ b/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewModel.cs @@ -109,7 +109,7 @@ public static CreateNewModel FromBlogPost(BlogPost blogPost) public BlogPost ToBlogPost() { var tagList = string.IsNullOrWhiteSpace(Tags) - ? Array.Empty() + ? [] : Tags.Split(",", StringSplitOptions.RemoveEmptyEntries); DateTime? updatedDate = ShouldUpdateDate || originalUpdatedDate == default ? null diff --git a/src/LinkDotNet.Blog.Web/Features/Services/LocalStorageService.cs b/src/LinkDotNet.Blog.Web/Features/Services/LocalStorageService.cs index ab917ef2..06ce8430 100644 --- a/src/LinkDotNet.Blog.Web/Features/Services/LocalStorageService.cs +++ b/src/LinkDotNet.Blog.Web/Features/Services/LocalStorageService.cs @@ -12,18 +12,9 @@ public LocalStorageService(ProtectedLocalStorage localStorage) this.localStorage = localStorage; } - public async ValueTask ContainKeyAsync(string key) - { - return (await localStorage.GetAsync(key)).Success; - } + public async ValueTask ContainKeyAsync(string key) => (await localStorage.GetAsync(key)).Success; - public async ValueTask GetItemAsync(string key) - { - return (await localStorage.GetAsync(key)).Value; - } + public async ValueTask GetItemAsync(string key) => (await localStorage.GetAsync(key)).Value; - public async ValueTask SetItemAsync(string key, T value) - { - await localStorage.SetAsync(key, value); - } -} \ No newline at end of file + public async ValueTask SetItemAsync(string key, T value) => await localStorage.SetAsync(key, value); +}