From 3efabde0ae6c76dff446fb0d0a59bd3fd2b9d74b Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Sun, 19 May 2024 20:40:34 +0300 Subject: [PATCH] Remove warnings related to CA1707 --- Directory.Build.props | 3 --- .../Services/AzureEmailProviderBase.cs | 2 ++ .../PagerShapesTableProvider.cs | 2 ++ .../LuceneContentPickerShapeProvider.cs | 2 ++ .../ShapeFactoryExtensions.cs | 20 +++++++++---------- .../ElasticContentPickerShapeProvider.cs | 2 ++ .../OrchardCore.Abstractions.Tests.csproj | 6 ++---- .../OrchardCore.Benchmarks.csproj | 2 ++ .../OrchardCore.Tests.csproj | 2 ++ 9 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 735e9c009c98..66c756210d99 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -48,9 +48,6 @@ $(NoWarn);CA2201 - - $(NoWarn);CA1707 - $(NoWarn);CA1727 diff --git a/src/OrchardCore.Modules/OrchardCore.Email.Azure/Services/AzureEmailProviderBase.cs b/src/OrchardCore.Modules/OrchardCore.Email.Azure/Services/AzureEmailProviderBase.cs index 39e4329eb99d..29649008a833 100644 --- a/src/OrchardCore.Modules/OrchardCore.Email.Azure/Services/AzureEmailProviderBase.cs +++ b/src/OrchardCore.Modules/OrchardCore.Email.Azure/Services/AzureEmailProviderBase.cs @@ -16,7 +16,9 @@ public abstract class AzureEmailProviderBase : IEmailProvider // Common supported file extensions and their corresponding MIME types for email attachments // using Azure Communication Services Email. // For more info +#pragma warning disable CA1707 protected static readonly Dictionary _allowedMimeTypes = new() +#pragma warning restore CA1707 { { ".3gp", "video/3gpp" }, { ".3g2", "video/3gpp2" }, diff --git a/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs b/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs index 53506f88f5b8..b31b4841a54b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs @@ -1,3 +1,5 @@ +#pragma warning disable CA1707 // Remove the underscores from member name + using System; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Shapes/LuceneContentPickerShapeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Shapes/LuceneContentPickerShapeProvider.cs index 733824360cc8..ebc8472f4bfb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Shapes/LuceneContentPickerShapeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Shapes/LuceneContentPickerShapeProvider.cs @@ -18,7 +18,9 @@ public LuceneContentPickerShapeProvider(IStringLocalizer PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount) - => _shapeFactory.CreateAsync(nameof(Pager), Arguments.From(new + public static ValueTask PagerAsync(this IShapeFactory shapeFactory, Pager pager, int totalItemCount) + => shapeFactory.CreateAsync(nameof(Pager), Arguments.From(new { pager.Page, pager.PageSize, TotalItemCount = totalItemCount, })); - public static async ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount, RouteData routeData) + public static async ValueTask PagerAsync(this IShapeFactory shapeFactory, Pager pager, int totalItemCount, RouteData routeData) { - var pagerShape = await _shapeFactory.PagerAsync(pager, totalItemCount); + var pagerShape = await shapeFactory.PagerAsync(pager, totalItemCount); if (routeData != null) { @@ -27,20 +27,20 @@ public static async ValueTask PagerAsync(this IShapeFactory _shapeFactor return pagerShape; } - public static ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount, RouteValueDictionary routeValues) - => _shapeFactory.PagerAsync(pager, totalItemCount, routeValues == null ? null : new RouteData(routeValues)); + public static ValueTask PagerAsync(this IShapeFactory shapeFactory, Pager pager, int totalItemCount, RouteValueDictionary routeValues) + => shapeFactory.PagerAsync(pager, totalItemCount, routeValues == null ? null : new RouteData(routeValues)); - public static ValueTask PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager) - => _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new + public static ValueTask PagerSlimAsync(this IShapeFactory shapeFactory, PagerSlim pager) + => shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new { pager.Before, pager.After, pager.PageSize, })); - public static async ValueTask PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager, IDictionary values) + public static async ValueTask PagerSlimAsync(this IShapeFactory shapeFactory, PagerSlim pager, IDictionary values) { - var shape = await _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new + var shape = await shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new { pager.Before, pager.After, diff --git a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Shapes/ElasticContentPickerShapeProvider.cs b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Shapes/ElasticContentPickerShapeProvider.cs index ef58bcf9be6c..4f3f229fcb36 100644 --- a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Shapes/ElasticContentPickerShapeProvider.cs +++ b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Shapes/ElasticContentPickerShapeProvider.cs @@ -18,7 +18,9 @@ public ElasticContentPickerShapeProvider(IStringLocalizer $(CommonTargetFrameworks) OrchardCore + + $(NoWarn);CA1707 - - diff --git a/test/OrchardCore.Benchmarks/OrchardCore.Benchmarks.csproj b/test/OrchardCore.Benchmarks/OrchardCore.Benchmarks.csproj index 04cbbed1a4ca..22ce21b43404 100644 --- a/test/OrchardCore.Benchmarks/OrchardCore.Benchmarks.csproj +++ b/test/OrchardCore.Benchmarks/OrchardCore.Benchmarks.csproj @@ -7,6 +7,8 @@ OrchardCore.Benchmark false Exe + + $(NoWarn);CA1707 diff --git a/test/OrchardCore.Tests/OrchardCore.Tests.csproj b/test/OrchardCore.Tests/OrchardCore.Tests.csproj index 28995c4eb9f9..a11ad9ecb368 100644 --- a/test/OrchardCore.Tests/OrchardCore.Tests.csproj +++ b/test/OrchardCore.Tests/OrchardCore.Tests.csproj @@ -4,6 +4,8 @@ $(CommonTargetFrameworks) + + $(NoWarn);CA1707