Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings related to CA1707 #16101

Merged
merged 3 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,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,7 @@ 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" />
protected static readonly Dictionary<string, string> _allowedMimeTypes = new()
protected static readonly Dictionary<string, string> AllowedMimeTypes = new()
{
{ ".3gp", "video/3gpp" },
{ ".3g2", "video/3gpp2" },
Expand Down Expand Up @@ -206,7 +206,7 @@ private EmailMessage FromMailMessage(MailMessage message, Dictionary<string, ILi
}
var extension = Path.GetExtension(attachment.Filename);

if (_allowedMimeTypes.TryGetValue(extension, out var contentType))
if (AllowedMimeTypes.TryGetValue(extension, out var contentType))
{
var data = new byte[attachment.Stream.Length];

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