From c71f0babad663b7c7ba0780ac25a7bb7070bb00c Mon Sep 17 00:00:00 2001 From: cairnsj <51908793+cairnsj@users.noreply.github.com> Date: Wed, 20 Sep 2023 08:38:15 +0100 Subject: [PATCH] Sonar suggestions --- .../Views/Content/Index.cshtml | 2 +- .../Views/Cookie/Cookies.cshtml | 4 ---- .../Views/Shared/_ContentSeparator.cshtml | 8 ++++---- .../Views/Shared/_RichText.cshtml | 19 +++++++++---------- .../Views/Shared/_RichTextBlock.cshtml | 2 +- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Childrens-Social-Care-CPD/Views/Content/Index.cshtml b/Childrens-Social-Care-CPD/Views/Content/Index.cshtml index 745cda64..d3f91a90 100644 --- a/Childrens-Social-Care-CPD/Views/Content/Index.cshtml +++ b/Childrens-Social-Care-CPD/Views/Content/Index.cshtml @@ -15,7 +15,7 @@ @section Hero { @{ - var heroBanner = Model.Items?.FirstOrDefault(x => x.GetType() == typeof(HeroBanner)); + var heroBanner = Model.Items?.Find(x => x.GetType() == typeof(HeroBanner)); if (heroBanner != null) { diff --git a/Childrens-Social-Care-CPD/Views/Cookie/Cookies.cshtml b/Childrens-Social-Care-CPD/Views/Cookie/Cookies.cshtml index ab72844c..00aaee4d 100644 --- a/Childrens-Social-Care-CPD/Views/Cookie/Cookies.cshtml +++ b/Childrens-Social-Care-CPD/Views/Cookie/Cookies.cshtml @@ -9,10 +9,6 @@ @inject ICookieHelper _cookieHelper @inject IRenderer _contentLinkRenderer -@{ - var prefsHaveBeenSet = _cookieHelper.GetRequestAnalyticsCookieState(Context) != AnalyticsConsentState.NotSet; -} - @if (ViewBag.ContextModel.PreferenceSet) {
diff --git a/Childrens-Social-Care-CPD/Views/Shared/_ContentSeparator.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_ContentSeparator.cshtml index f0452a86..86a0a4bf 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_ContentSeparator.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_ContentSeparator.cshtml @@ -6,16 +6,16 @@ switch (Model.Type) { case "Extra Large" : -
; +
break; case "Large" : -
; +
break; case "Medium":
- ; break; + break; case "Small":
- ; break; + break; } } diff --git a/Childrens-Social-Care-CPD/Views/Shared/_RichText.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_RichText.cshtml index 96c71408..de1994da 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_RichText.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_RichText.cshtml @@ -29,19 +29,18 @@ case HorizontalRuler hr: @_horizontalRulerRenderer.Render(hr); break; case Paragraph paragraph: @_paragraphRenderer.Render(paragraph); break; case List list: @_listRenderer.Render(list); break; - case Heading1 heading1: @_heading1Renderer.Render(heading1); break; - case Heading2 heading2: @_heading2Renderer.Render(heading2); break; - case Heading3 heading3: @_heading3Renderer.Render(heading3); break; - case Heading4 heading4: @_heading4Renderer.Render(heading4); break; - case Heading5 heading5: @_heading5Renderer.Render(heading5); break; - case Heading6 heading6: @_heading6Renderer.Render(heading6); break; - case Table table: @_tableRenderer.Render(table); break; - case Quote quote: @_quoteRenderer.Render(quote) - ; break; + case Heading1 heading1: @_heading1Renderer.Render(heading1) break; + case Heading2 heading2: @_heading2Renderer.Render(heading2) break; + case Heading3 heading3: @_heading3Renderer.Render(heading3) break; + case Heading4 heading4: @_heading4Renderer.Render(heading4) break; + case Heading5 heading5: @_heading5Renderer.Render(heading5) break; + case Heading6 heading6: @_heading6Renderer.Render(heading6) break; + case Table table: @_tableRenderer.Render(table) break; + case Quote quote: @_quoteRenderer.Render(quote) break; case EntryStructure entryStructure: { switch (entryStructure.Data.Target) { - case RoleList roleList: @_roleListRenderer.Render(roleList); break; + case RoleList roleList: @_roleListRenderer.Render(roleList) break; } break; } diff --git a/Childrens-Social-Care-CPD/Views/Shared/_RichTextBlock.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_RichTextBlock.cshtml index 0dac80bf..fdcb2fec 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_RichTextBlock.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_RichTextBlock.cshtml @@ -15,7 +15,7 @@ var tagBuilder = new TagBuilder($"h{level}"); tagBuilder.InnerHtml.Append(Model.Title); - @tagBuilder; + @tagBuilder } } }