Skip to content

Commit

Permalink
Merge pull request #127 from Lombiq/issue/OSOE-606
Browse files Browse the repository at this point in the history
OSOE-606: Fixing new C# 11 analyzer violations
  • Loading branch information
0liver authored Jun 6, 2023
2 parents 548df55 + 59d5895 commit 80f0387
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private string ConvertJArray(JArray jArray, int indentationDepth)
var items = jArray.Select(item => ConvertJToken(item, indentationDepth + 8)).ToList();

// If the items are formatted (for ListValueOption) then don't inject line-by-line formatting.
if (items.Any(item => item.ContainsOrdinalIgnoreCase(Environment.NewLine)))
if (items.Exists(item => item.ContainsOrdinalIgnoreCase(Environment.NewLine)))
{
var token = string.Join(string.Empty, items);
return $"new[]\n{indentation}{{\n{token}{indentation}}}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Lombiq.HelpfulExtensions.Extensions.Flows;

internal class FlowPartShapeTableProvider : IShapeTableProvider
internal sealed class FlowPartShapeTableProvider : IShapeTableProvider
{
public void Discover(ShapeTableBuilder builder) => builder
.Describe("FlowPart")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using Lombiq.HelpfulExtensions.Extensions.OrchardRecipeMigration.Models;
using Lombiq.HelpfulExtensions.Extensions.OrchardRecipeMigration.Models;
using OrchardCore.Alias.Models;
using OrchardCore.Autoroute.Models;
using OrchardCore.ContentManagement;
using OrchardCore.Html.Models;
using OrchardCore.Title.Models;
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
Expand Down Expand Up @@ -71,7 +70,7 @@ bool HasElementAttribute(string elementName, string attributeName, out string va
return Task.CompletedTask;
}

private static string GetAlias(string value) => value.Split("/alias=").Last().Trim().Replace("\\/", "/");
private static string GetAlias(string value) => value.Split("/alias=")[^1].Trim().Replace("\\/", "/");

private static void AlterIfPartExists<TPart>(ContentItem contentItem, Action<TPart> action)
where TPart : ContentPart, new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Lombiq.HelpfulExtensions.Extensions.ShapeTracing;

internal class ShapeTracingShapeEvents : IShapeDisplayEvents
internal sealed class ShapeTracingShapeEvents : IShapeDisplayEvents
{
private readonly IHttpContextAccessor _hca;

Expand Down
5 changes: 3 additions & 2 deletions Lombiq.HelpfulExtensions/Views/MenuWidget.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using Lombiq.HelpfulExtensions.Extensions.Widgets.ViewModels
@using Lombiq.HelpfulLibraries.Common.Utilities;
@using Microsoft.AspNetCore.Http.Extensions
@using OrchardCore.Navigation
<style asp-name="font-awesome"></style>
Expand All @@ -12,7 +13,7 @@
const string dropdownElementName = blockName + "__dropdown";
const string dropdownItemElementName = blockName + "__dropdownItem";

var contentIdName = FormattableString.Invariant($"{contentElementName}_{Guid.NewGuid()}");
var contentIdName = StringHelper.CreateInvariant($"{contentElementName}_{Guid.NewGuid()}");

var baseUri = new Uri(Context.Request.GetDisplayUrl());

Expand Down Expand Up @@ -50,7 +51,7 @@
<ul class="navbar-nav me-auto mb-lg-0">
@foreach (var menuItem in menuItems)
{
var dropdownIdName = FormattableString.Invariant($"{dropdownElementName}_{Guid.NewGuid()}");
var dropdownIdName = StringHelper.CreateInvariant($"{dropdownElementName}_{Guid.NewGuid()}");
@if (menuItem.Items.Any())
{
var submenuItems = menuItem
Expand Down

0 comments on commit 80f0387

Please sign in to comment.