From b0858b6e67c13a10937a672d735a68e7be7866c3 Mon Sep 17 00:00:00 2001 From: Jcparkyn <51850908+Jcparkyn@users.noreply.github.com> Date: Thu, 23 Nov 2023 18:53:14 +1100 Subject: [PATCH] Code formatting --- .editorconfig | 10 +++++----- samples/HackerNewsClient/Shared/HackerNewsApi.cs | 1 - samples/HackerNewsClient/Shared/QueryParam.cs | 3 +-- samples/PhetchBlazorDemo/Program.cs | 6 +++--- src/Phetch.Blazor/UseEndpoint.razor.cs | 2 +- src/Phetch.Core/IsExternalInit.cs | 4 +++- src/Phetch.Core/RetryHandler.cs | 4 ++-- test/Phetch.Blazor.Tests/BlazorTestHelpers.cs | 13 ++++++------- .../UseParameterlessEndpointTests.razor | 1 + test/Phetch.Tests/MockQueryFunction.cs | 3 ++- test/Phetch.Tests/OptionsTests.cs | 2 +- test/Phetch.Tests/TestHelpers.cs | 11 +++++------ 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.editorconfig b/.editorconfig index 89aa840..ee141e7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -64,6 +64,11 @@ csharp_style_namespace_declarations=file_scoped:warning csharp_using_directive_placement = inside_namespace:warning dotnet_style_namespace_match_folder=true:warning +# IDE0005: Using directive is unnecessary. +dotnet_diagnostic.IDE0005.severity = warning +# IDE0130: Namespace does not match folder structure +dotnet_diagnostic.IDE0130.severity = warning + # Avoid "this." and "Me." if not necessary dotnet_style_qualification_for_field = false:refactoring dotnet_style_qualification_for_property = false:refactoring @@ -319,8 +324,3 @@ dotnet_diagnostic.IDE2004.severity = warning # CA1822: Make member static # There is a risk of accidentally breaking an internal API that partners rely on though IVT. dotnet_code_quality.CA1822.api_surface = private - -# IDE0005: Using directive is unnecessary. -dotnet_diagnostic.IDE0005.severity = warning -# IDE0130: Namespace does not match folder structure -dotnet_diagnostic.IDE0130.severity = warning \ No newline at end of file diff --git a/samples/HackerNewsClient/Shared/HackerNewsApi.cs b/samples/HackerNewsClient/Shared/HackerNewsApi.cs index 780a5c3..94b9f57 100644 --- a/samples/HackerNewsClient/Shared/HackerNewsApi.cs +++ b/samples/HackerNewsClient/Shared/HackerNewsApi.cs @@ -1,6 +1,5 @@ namespace HackerNewsClient.Shared; -using System.Net; using System.Net.Http; using System.Net.Http.Json; using System.Text.Json.Serialization; diff --git a/samples/HackerNewsClient/Shared/QueryParam.cs b/samples/HackerNewsClient/Shared/QueryParam.cs index 8ea6ec8..73e3ae3 100644 --- a/samples/HackerNewsClient/Shared/QueryParam.cs +++ b/samples/HackerNewsClient/Shared/QueryParam.cs @@ -1,9 +1,8 @@ namespace HackerNewsClient.Shared; +using System.Globalization; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.WebUtilities; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; public sealed class QueryParam { diff --git a/samples/PhetchBlazorDemo/Program.cs b/samples/PhetchBlazorDemo/Program.cs index 730a8b2..f66d2ac 100644 --- a/samples/PhetchBlazorDemo/Program.cs +++ b/samples/PhetchBlazorDemo/Program.cs @@ -1,8 +1,8 @@ -using Microsoft.AspNetCore.Components.Web; +using Blazored.LocalStorage; +using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using PhetchBlazorDemo; using MudBlazor.Services; -using Blazored.LocalStorage; +using PhetchBlazorDemo; using PhetchBlazorDemo.Shared; var builder = WebAssemblyHostBuilder.CreateDefault(args); diff --git a/src/Phetch.Blazor/UseEndpoint.razor.cs b/src/Phetch.Blazor/UseEndpoint.razor.cs index ed6d4c9..5062a20 100644 --- a/src/Phetch.Blazor/UseEndpoint.razor.cs +++ b/src/Phetch.Blazor/UseEndpoint.razor.cs @@ -1,8 +1,8 @@ namespace Phetch.Blazor; +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Components; using Phetch.Core; -using System.Diagnostics.CodeAnalysis; /// /// A component that can be used to call an endpoint and access the result. diff --git a/src/Phetch.Core/IsExternalInit.cs b/src/Phetch.Core/IsExternalInit.cs index 4351fad..3210320 100644 --- a/src/Phetch.Core/IsExternalInit.cs +++ b/src/Phetch.Core/IsExternalInit.cs @@ -1,3 +1,5 @@ -namespace System.Runtime.CompilerServices; +#pragma warning disable IDE0130 // Namespace does not match folder structure +namespace System.Runtime.CompilerServices; +#pragma warning restore IDE0130 // Namespace does not match folder structure internal static class IsExternalInit { } diff --git a/src/Phetch.Core/RetryHandler.cs b/src/Phetch.Core/RetryHandler.cs index f816574..a8ed15d 100644 --- a/src/Phetch.Core/RetryHandler.cs +++ b/src/Phetch.Core/RetryHandler.cs @@ -1,9 +1,9 @@ namespace Phetch.Core; using System; -using System.Threading.Tasks; -using System.Threading; using System.Diagnostics.CodeAnalysis; +using System.Threading; +using System.Threading.Tasks; /// /// An interface to allow queries to be retried when they fail. diff --git a/test/Phetch.Blazor.Tests/BlazorTestHelpers.cs b/test/Phetch.Blazor.Tests/BlazorTestHelpers.cs index b1dd472..d06516c 100644 --- a/test/Phetch.Blazor.Tests/BlazorTestHelpers.cs +++ b/test/Phetch.Blazor.Tests/BlazorTestHelpers.cs @@ -2,27 +2,26 @@ using System; using System.Collections.Generic; -using System.Linq; internal static class BlazorTestHelpers { public static (Action, List) MakeMonitoredAction() { var actionCalls = new List(); - var action = (T arg) => + void Action(T arg) { actionCalls.Add(arg); - }; - return (action, actionCalls); + } + return (Action, actionCalls); } public static (Action, List) MakeMonitoredAction() { var actionCalls = new List(); - var action = () => + void Action() { actionCalls.Add(null); - }; - return (action, actionCalls); + } + return (Action, actionCalls); } } diff --git a/test/Phetch.Blazor.Tests/UseParameterlessEndpointTests.razor b/test/Phetch.Blazor.Tests/UseParameterlessEndpointTests.razor index 40df083..5492522 100644 --- a/test/Phetch.Blazor.Tests/UseParameterlessEndpointTests.razor +++ b/test/Phetch.Blazor.Tests/UseParameterlessEndpointTests.razor @@ -1,5 +1,6 @@ @using FluentAssertions.Execution; @using System.Collections.Specialized; +@using Phetch.Tests @inherits TestContext @code { diff --git a/test/Phetch.Tests/MockQueryFunction.cs b/test/Phetch.Tests/MockQueryFunction.cs index 8daf589..4158cdf 100644 --- a/test/Phetch.Tests/MockQueryFunction.cs +++ b/test/Phetch.Tests/MockQueryFunction.cs @@ -1,9 +1,10 @@ -namespace Phetch.Core; +namespace Phetch.Tests; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Phetch.Core; /// /// Class for creating query functions for testing. diff --git a/test/Phetch.Tests/OptionsTests.cs b/test/Phetch.Tests/OptionsTests.cs index 0c69eec..111da6d 100644 --- a/test/Phetch.Tests/OptionsTests.cs +++ b/test/Phetch.Tests/OptionsTests.cs @@ -1,9 +1,9 @@ namespace Phetch.Tests; +using System; using FluentAssertions; using FluentAssertions.Execution; using Phetch.Core; -using System; using Xunit; public class OptionsTests diff --git a/test/Phetch.Tests/TestHelpers.cs b/test/Phetch.Tests/TestHelpers.cs index df4b415..8157704 100644 --- a/test/Phetch.Tests/TestHelpers.cs +++ b/test/Phetch.Tests/TestHelpers.cs @@ -1,10 +1,9 @@ namespace Phetch.Tests; -using System.Collections.Generic; using System; -using System.Threading.Tasks; -using System.Linq; +using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; using Phetch.Core; using Polly; @@ -23,13 +22,13 @@ public static async Task ReturnAsync(T value) public static (Func> queryFn, IReadOnlyList queryFnCalls) MakeTrackedQueryFn() { var queryFnCalls = new List(); - var queryFn = async (int val) => + async Task QueryFn(int val) { queryFnCalls.Add(val); await Task.Yield(); return val.ToString(); - }; - return (queryFn, queryFnCalls); + } + return (QueryFn, queryFnCalls); } }