Skip to content

Commit

Permalink
Remove warnings related to CA1707
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed May 19, 2024
1 parent 21d2a70 commit aaf0bf4
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 17 deletions.
3 changes: 0 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
<!-- Exception type is not sufficiently specific -->
<NoWarn>$(NoWarn);CA2201</NoWarn>

<!-- Remove the underscores from member name -->
<NoWarn>$(NoWarn);CA1707</NoWarn>

<!-- Use PascalCase for named placeholders in the logging message template -->
<NoWarn>$(NoWarn);CA1727</NoWarn>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <see href="https://learn.microsoft.com/en-us/azure/communication-services/concepts/email/email-attachment-allowed-mime-types" />
#pragma warning disable CA1707 // Remove the underscores from member name
protected static readonly Dictionary<string, string> _allowedMimeTypes = new()
#pragma warning restore CA1707
{
{ ".3gp", "video/3gpp" },
{ ".3g2", "video/3gpp2" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma warning disable CA1707 // Remove the underscores from member name

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public LuceneContentPickerShapeProvider(IStringLocalizer<LuceneContentPickerShap
}

[Shape]
#pragma warning disable CA1707 // Remove the underscores from member name
public IHtmlContent ContentPickerField_Option__Lucene(dynamic shape)
#pragma warning restore CA1707
{
var selected = shape.Editor == "Lucene";
if (selected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ namespace OrchardCore.DisplayManagement;

public static class ShapeFactoryExtensions
{
public static ValueTask<IShape> PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount)
=> _shapeFactory.CreateAsync(nameof(Pager), Arguments.From(new
public static ValueTask<IShape> 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<IShape> PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount, RouteData routeData)
public static async ValueTask<IShape> 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)
{
Expand All @@ -27,20 +27,20 @@ public static async ValueTask<IShape> PagerAsync(this IShapeFactory _shapeFactor
return pagerShape;
}

public static ValueTask<IShape> PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount, RouteValueDictionary routeValues)
=> _shapeFactory.PagerAsync(pager, totalItemCount, routeValues == null ? null : new RouteData(routeValues));
public static ValueTask<IShape> PagerAsync(this IShapeFactory shapeFactory, Pager pager, int totalItemCount, RouteValueDictionary routeValues)
=> shapeFactory.PagerAsync(pager, totalItemCount, routeValues == null ? null : new RouteData(routeValues));

public static ValueTask<IShape> PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager)
=> _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new
public static ValueTask<IShape> PagerSlimAsync(this IShapeFactory shapeFactory, PagerSlim pager)
=> shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new
{
pager.Before,
pager.After,
pager.PageSize,
}));

public static async ValueTask<IShape> PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager, IDictionary<string, string> values)
public static async ValueTask<IShape> PagerSlimAsync(this IShapeFactory shapeFactory, PagerSlim pager, IDictionary<string, string> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public ElasticContentPickerShapeProvider(IStringLocalizer<ElasticContentPickerSh
}

[Shape]
#pragma warning disable CA1707 // Remove the underscores from member name
public IHtmlContent ContentPickerField_Option__Elasticsearch(dynamic shape)
#pragma warning restore CA1707
{
var selected = shape.Editor == "Elasticsearch";
if (selected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
<PropertyGroup>
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks>
<RootNamespace>OrchardCore</RootNamespace>
<!-- Remove the underscores from member name -->
<NoWarn>$(NoWarn);CA1707</NoWarn>
</PropertyGroup>

<!--<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>-->

<ItemGroup>
<None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions test/OrchardCore.Benchmarks/OrchardCore.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<RootNamespace>OrchardCore.Benchmark</RootNamespace>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<!-- Remove the underscores from member name -->
<NoWarn>$(NoWarn);CA1707</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions test/OrchardCore.Tests/OrchardCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

<PropertyGroup>
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks>
<!-- Remove the underscores from member name -->
<NoWarn>$(NoWarn);CA1707</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit aaf0bf4

Please sign in to comment.