From e49b924cfb4f1f0d07fe08fdd66691215906b9ef Mon Sep 17 00:00:00 2001 From: ancplua Date: Mon, 11 May 2026 19:49:17 +0200 Subject: [PATCH] style: enforce IDE0055 for CI builds --- .editorconfig | 5 +++++ tests/ANcpLua.Sdk.Tests/SdkTests.cs | 5 ++++- tests/ANcpLua.Sdk.Tests/TemplatesTests.cs | 20 ++++++++++++++++---- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3937b59..fc4d7ff 100644 --- a/.editorconfig +++ b/.editorconfig @@ -44,6 +44,11 @@ indent_size = 4 insert_final_newline = true charset = utf-8 +# Repo-local CI strictness: set IDE0055 to warning so it can be enforced by +# `EnforceCodeStyleInBuild` (Microsoft Learn: IDE0055 must be warning/error to +# run during build). +dotnet_diagnostic.IDE0055.severity = warning + # C# naming conventions live in src/Config/NamingConvention.editorconfig # (single source of truth, dotnet/runtime aligned, shipped with the SDK package). # Directory.Build.props injects it for this repo's own projects via EditorConfigFiles. diff --git a/tests/ANcpLua.Sdk.Tests/SdkTests.cs b/tests/ANcpLua.Sdk.Tests/SdkTests.cs index 890159b..4c32655 100644 --- a/tests/ANcpLua.Sdk.Tests/SdkTests.cs +++ b/tests/ANcpLua.Sdk.Tests/SdkTests.cs @@ -273,7 +273,10 @@ public async Task EditorConfigsAreInBinlog() .BuildAsync(); var files = result.GetBinLogFiles(); - foreach (var file in files) TestContext.Current.TestOutputHelper?.WriteLine("Binlog file: " + file); + foreach (var file in files) + { + TestContext.Current.TestOutputHelper?.WriteLine("Binlog file: " + file); + } Assert.Contains(files, static f => f.EndsWith(".editorconfig", StringComparison.Ordinal)); Assert.Contains(files, f => f == localFile || f == "/private" + localFile); diff --git a/tests/ANcpLua.Sdk.Tests/TemplatesTests.cs b/tests/ANcpLua.Sdk.Tests/TemplatesTests.cs index af625bd..3d5bf9f 100644 --- a/tests/ANcpLua.Sdk.Tests/TemplatesTests.cs +++ b/tests/ANcpLua.Sdk.Tests/TemplatesTests.cs @@ -365,7 +365,10 @@ private static async Task DotnetNewScaffoldAsync( "--debug:custom-hive", hive, "--skipRestore" }; - if (extraArgs is not null) args.AddRange(extraArgs); + if (extraArgs is not null) + { + args.AddRange(extraArgs); + } var result = await RunDotnetAsync(args, workingDirectory: null); Assert.True( @@ -393,7 +396,10 @@ private async Task ReadEntryAsync(string entryPath) CreateNoWindow = true, WorkingDirectory = workingDirectory?.Value ?? Environment.CurrentDirectory }; - foreach (var arg in args) psi.ArgumentList.Add(arg.ToString() ?? ""); + foreach (var arg in args) + { + psi.ArgumentList.Add(arg.ToString() ?? ""); + } var result = await psi.RunAsTaskAsync(TestContext.Current.CancellationToken); return (result.ExitCode, result.Output.ToString()); @@ -416,7 +422,10 @@ private static FullPath Canonicalize(FullPath path) try { var resolved = new DirectoryInfo(path.Value).ResolveLinkTarget(returnFinalTarget: true)?.FullName; - if (!string.IsNullOrEmpty(resolved)) return FullPath.FromPath(resolved); + if (!string.IsNullOrEmpty(resolved)) + { + return FullPath.FromPath(resolved); + } // No direct symlink on the leaf; walk up to find an ancestor that is one // (e.g. /var → /private/var) and rebuild the path through the resolved ancestor. @@ -430,7 +439,10 @@ private static FullPath Canonicalize(FullPath path) if (link is not null) { var rebuilt = link.FullName; - while (suffix.Count > 0) rebuilt = Path.Combine(rebuilt, suffix.Pop()); + while (suffix.Count > 0) + { + rebuilt = Path.Combine(rebuilt, suffix.Pop()); + } return FullPath.FromPath(rebuilt); }