From 46bf771f11c7ec8486ed3cfb2156fa15e4ec9718 Mon Sep 17 00:00:00 2001 From: Widthdom Date: Sat, 25 Jul 2026 15:46:46 +0900 Subject: [PATCH 1/2] Enforce reproducible formatting baseline --- .editorconfig | 18 ++++++ .gitattributes | 11 ++++ .github/workflows/dotnet.yml | 3 + CONTRIBUTING.md | 34 ++++++++++ .../Console/ConsoleBanner.cs | 14 ++-- .../CiAutomationConfigurationTests.cs | 37 +++++++++++ .../Core/Text/TextDifferTests.cs | 4 +- ...DisassembleServiceTests.UnitAndPrefetch.cs | 2 +- .../Services/FolderDiffServiceTests.cs | 28 ++++---- ProgramRunner.cs | 14 ++-- Runner/ProgramRunner.OpenFolder.cs | 8 +-- Runner/RunScopeBuilder.cs | 10 +-- Services/ConfigService.cs | 64 +++++++++---------- .../HtmlReportGenerateService.DetailRows.cs | 8 +-- .../HtmlReportGenerateService.Helpers.cs | 6 +- .../HtmlReportGenerateService.Sections.cs | 2 +- Services/HtmlReportGenerateService.cs | 10 +-- Services/LoggerService.cs | 4 +- global.json | 7 +- 19 files changed, 194 insertions(+), 90 deletions(-) create mode 100644 .gitattributes diff --git a/.editorconfig b/.editorconfig index 9ed072ee..6321d8ab 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,7 +1,25 @@ root = true +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + [*.cs] +indent_style = space +indent_size = 4 +tab_width = 4 dotnet_diagnostic.CA1031.severity = warning [FolderDiffIL4DotNet.Tests/**/*.cs] dotnet_diagnostic.CA1031.severity = none + +[*.{g,g.i,generated,designer}.cs] +generated_code = true + +[**/Generated/**/*.cs] +generated_code = true + +[*.{bat,cmd}] +end_of_line = crlf diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..82f41b1d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +* text=auto eol=lf + +*.bat text eol=crlf +*.cmd text eol=crlf + +*.gif binary +*.ico binary +*.jpg binary +*.jpeg binary +*.png binary +*.zip binary diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index ba76cf69..c196afa5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -61,6 +61,9 @@ jobs: - name: Restore dependencies run: dotnet restore FolderDiffIL4DotNet.sln + - name: Verify formatting + run: dotnet format FolderDiffIL4DotNet.sln --verify-no-changes --no-restore --verbosity minimal + - name: Test NuGet audit gate run: python3 -m unittest discover -s scripts/tests -p 'test_*.py' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2932cfe4..da587264 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,6 +16,23 @@ Before opening a pull request: If you are reporting a bug, include the exact command, OS, .NET SDK version, and sanitized output. Do not paste private paths, customer data, proprietary binaries, or exploit details into public issues. +### Formatting + +[`global.json`](global.json) pins the .NET SDK used by developers and CI, and [`.editorconfig`](.editorconfig) is the formatting source of truth. Install the pinned SDK, then run: + +```shell +dotnet restore FolderDiffIL4DotNet.sln +dotnet format FolderDiffIL4DotNet.sln --verify-no-changes --no-restore +``` + +To fix formatting drift locally, replace the verification command with: + +```shell +dotnet format FolderDiffIL4DotNet.sln --no-restore +``` + +Tracked text files use LF through [`.gitattributes`](.gitattributes), except Windows command scripts (`*.bat` and `*.cmd`), which use CRLF. Binary assets are marked as binary. Build output under `bin/` and `obj/`, files recognized by the SDK as generated, and conventional generated C# filenames are not part of the hand-maintained formatting baseline. + ## 日本語 `FolderDiffIL4DotNet` の改善に協力していただきありがとうございます。 @@ -31,3 +48,20 @@ Do not paste private paths, customer data, proprietary binaries, or exploit deta 不具合報告には、実行したコマンド、OS、.NET SDK バージョン、匿名化した出力を含めてください。 public issue に private なパス、顧客データ、プロプライエタリなバイナリ、攻撃詳細を貼らないでください。 + +### フォーマット + +開発環境と CI で使う .NET SDK は [`global.json`](global.json) で固定し、フォーマット規則は [`.editorconfig`](.editorconfig) を正本とします。固定された SDK をインストールしてから、次を実行してください。 + +```shell +dotnet restore FolderDiffIL4DotNet.sln +dotnet format FolderDiffIL4DotNet.sln --verify-no-changes --no-restore +``` + +手元でフォーマットのずれを修正するには、検証コマンドの代わりに次を実行します。 + +```shell +dotnet format FolderDiffIL4DotNet.sln --no-restore +``` + +追跡対象のテキストファイルは [`.gitattributes`](.gitattributes) により LF に統一します。ただし、Windows コマンドスクリプト(`*.bat` と `*.cmd`)は CRLF とします。バイナリアセットは binary として指定します。`bin/` と `obj/` 配下のビルド出力、SDK が生成済みと認識するファイル、および一般的な生成 C# ファイル名は、手作業で保守するフォーマット基準の対象外です。 diff --git a/FolderDiffIL4DotNet.Core/Console/ConsoleBanner.cs b/FolderDiffIL4DotNet.Core/Console/ConsoleBanner.cs index e5463cc2..f8eb96da 100644 --- a/FolderDiffIL4DotNet.Core/Console/ConsoleBanner.cs +++ b/FolderDiffIL4DotNet.Core/Console/ConsoleBanner.cs @@ -63,11 +63,11 @@ public static void PrintGreeting(int hour) /// public static string GetGreeting(int hour) => hour switch { - >= 0 and < 3 => "I hope you're enjoying hobby time, not working.", - >= 3 and < 5 => "I hope tomorrow is a day you can sleep in...", - >= 5 and < 7 => "You're up early! Did you sleep well?", - >= 7 and < 8 => "Leave the diff to me and go have breakfast!", - >= 8 and < 10 => "Good morning! Have you had breakfast?", + >= 0 and < 3 => "I hope you're enjoying hobby time, not working.", + >= 3 and < 5 => "I hope tomorrow is a day you can sleep in...", + >= 5 and < 7 => "You're up early! Did you sleep well?", + >= 7 and < 8 => "Leave the diff to me and go have breakfast!", + >= 8 and < 10 => "Good morning! Have you had breakfast?", >= 10 and < 11 => "Breaks matter. How about a coffee?", >= 11 and < 12 => "Almost lunchtime!", >= 12 and < 13 => "Leave the diff to me and go have lunch!", @@ -80,8 +80,8 @@ public static void PrintGreeting(int hour) >= 20 and < 21 => "Still have tasks left today? Thank you for your hard work.", >= 21 and < 22 => "Leave the diff to me and go take a shower!", >= 22 and < 23 => "Working late. Have you taken a shower?", - >= 23 => "The day is almost over. Take care of your health!", - _ => "Hello!", + >= 23 => "The day is almost over. Take care of your health!", + _ => "Hello!", }; } } diff --git a/FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs b/FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs index 702992ef..d966f011 100644 --- a/FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs +++ b/FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs @@ -49,6 +49,43 @@ public void DotNetWorkflow_DoesNotSkipDocumentationOnlyChanges() Assert.DoesNotContain("'**.md'", workflow, StringComparison.Ordinal); } + /// + /// Verifies that developers and CI share an exact SDK, formatting rules, and a blocking format gate. + /// 開発環境と CI が同一の SDK・フォーマット規則・ブロッキング形式検証を共有することを検証します。 + /// + [Fact] + [Trait("Category", "Unit")] + public void FormattingBaseline_PinsSdkAndIsEnforcedByCi() + { + var workflow = File.ReadAllText(GetRepositoryFilePath(".github", "workflows", "dotnet.yml")); + var editorConfig = File.ReadAllText(GetRepositoryFilePath(".editorconfig")); + var gitAttributes = File.ReadAllText(GetRepositoryFilePath(".gitattributes")); + var contributing = File.ReadAllText(GetRepositoryFilePath("CONTRIBUTING.md")); + var globalJson = JsonDocument.Parse(File.ReadAllText(GetRepositoryFilePath("global.json"))).RootElement; + var sdk = globalJson.GetProperty("sdk"); + + Assert.Equal("8.0.413", sdk.GetProperty("version").GetString()); + Assert.Equal("disable", sdk.GetProperty("rollForward").GetString()); + Assert.False(sdk.GetProperty("allowPrerelease").GetBoolean()); + Assert.Contains("global-json-file: global.json", workflow, StringComparison.Ordinal); + Assert.Contains("name: Verify formatting", workflow, StringComparison.Ordinal); + Assert.Contains( + "dotnet format FolderDiffIL4DotNet.sln --verify-no-changes --no-restore --verbosity minimal", + workflow, + StringComparison.Ordinal); + Assert.DoesNotContain("continue-on-error: true\n run: dotnet format", workflow, StringComparison.Ordinal); + Assert.Contains("end_of_line = lf", editorConfig, StringComparison.Ordinal); + Assert.Contains("indent_size = 4", editorConfig, StringComparison.Ordinal); + Assert.Contains("generated_code = true", editorConfig, StringComparison.Ordinal); + Assert.Contains("[*.{bat,cmd}]\nend_of_line = crlf", editorConfig, StringComparison.Ordinal); + Assert.Contains("* text=auto eol=lf", gitAttributes, StringComparison.Ordinal); + Assert.Contains("*.bat text eol=crlf", gitAttributes, StringComparison.Ordinal); + Assert.Contains( + "dotnet format FolderDiffIL4DotNet.sln --verify-no-changes --no-restore", + contributing, + StringComparison.Ordinal); + } + /// /// Verifies that npm metadata used for JavaScript tests does not drift from repository metadata. /// JavaScript テスト用 npm メタデータがリポジトリメタデータからずれないことを検証します。 diff --git a/FolderDiffIL4DotNet.Tests/Core/Text/TextDifferTests.cs b/FolderDiffIL4DotNet.Tests/Core/Text/TextDifferTests.cs index c3a30753..f22f2216 100644 --- a/FolderDiffIL4DotNet.Tests/Core/Text/TextDifferTests.cs +++ b/FolderDiffIL4DotNet.Tests/Core/Text/TextDifferTests.cs @@ -233,7 +233,7 @@ public void Compute_VeryLargeFilesWithTinyDiff_ProducesInlineDiff() var result = TextDiffer.Compute(old, @new, contextLines: 0); Assert.Contains(result, l => l.Kind == TextDiffer.Removed && l.Text == "old-changed"); - Assert.Contains(result, l => l.Kind == TextDiffer.Added && l.Text == "new-changed"); + Assert.Contains(result, l => l.Kind == TextDiffer.Added && l.Text == "new-changed"); // Should produce a proper diff, not a single Truncated entry // 単独の Truncated で返すのではなく、正しく差分が得られること Assert.False(result.Count == 1 && result[0].Kind == TextDiffer.Truncated); @@ -302,7 +302,7 @@ public void Compute_HunkHeaderLine_HasZeroLineNumbers() public void Compute_ContextLines_BothLineNumbersSet() { var old = new[] { "ctx", "changed", "ctx2" }; - var @new = new[] { "ctx", "new", "ctx2" }; + var @new = new[] { "ctx", "new", "ctx2" }; var result = TextDiffer.Compute(old, @new, contextLines: 1); diff --git a/FolderDiffIL4DotNet.Tests/Services/DotNetDisassembleServiceTests.UnitAndPrefetch.cs b/FolderDiffIL4DotNet.Tests/Services/DotNetDisassembleServiceTests.UnitAndPrefetch.cs index 7405bdac..d5af7fe2 100644 --- a/FolderDiffIL4DotNet.Tests/Services/DotNetDisassembleServiceTests.UnitAndPrefetch.cs +++ b/FolderDiffIL4DotNet.Tests/Services/DotNetDisassembleServiceTests.UnitAndPrefetch.cs @@ -62,7 +62,7 @@ public async Task DisassembleAsync_WhenVersionLookupFails_UsesFingerprintAndAvoi Assert.True(countAfterFirstRun > 0); // Simulate tool binary update by touching mtime to change fingerprint - // ツールバイナリの更新をシミュレートし、mtime 変更でフィンガープリントを変える + // ツールバイナリの更新をシミュレートし、mtime 変更でフィンガープリントを変える await Task.Delay(1100); var binaryPath = GetInstalledFakeBinaryPath(binDir, "dotnet-ildasm"); File.SetLastWriteTimeUtc(binaryPath, DateTime.UtcNow); diff --git a/FolderDiffIL4DotNet.Tests/Services/FolderDiffServiceTests.cs b/FolderDiffIL4DotNet.Tests/Services/FolderDiffServiceTests.cs index 18437ddc..f086d824 100644 --- a/FolderDiffIL4DotNet.Tests/Services/FolderDiffServiceTests.cs +++ b/FolderDiffIL4DotNet.Tests/Services/FolderDiffServiceTests.cs @@ -312,20 +312,20 @@ private static ConfigSettings CreateConfig( int maxParallelism, List textFileExtensions = null, bool shouldWarnWhenNewFileTimestampIsOlderThanOldFileTimestamp = true) => new ConfigSettingsBuilder() - { - IgnoredExtensions = new List { ".pdb" }, - TextFileExtensions = textFileExtensions ?? new List { ".txt" }, - ShouldIncludeUnchangedFiles = true, - ShouldIncludeIgnoredFiles = true, - ShouldOutputILText = false, - ShouldIgnoreILLinesContainingConfiguredStrings = false, - ILIgnoreLineContainingStrings = new List(), - ShouldOutputFileTimestamps = false, - ShouldWarnWhenNewFileTimestampIsOlderThanOldFileTimestamp = shouldWarnWhenNewFileTimestampIsOlderThanOldFileTimestamp, - MaxParallelism = maxParallelism, - OptimizeForNetworkShares = false, - AutoDetectNetworkShares = false - }.Build(); + { + IgnoredExtensions = new List { ".pdb" }, + TextFileExtensions = textFileExtensions ?? new List { ".txt" }, + ShouldIncludeUnchangedFiles = true, + ShouldIncludeIgnoredFiles = true, + ShouldOutputILText = false, + ShouldIgnoreILLinesContainingConfiguredStrings = false, + ILIgnoreLineContainingStrings = new List(), + ShouldOutputFileTimestamps = false, + ShouldWarnWhenNewFileTimestampIsOlderThanOldFileTimestamp = shouldWarnWhenNewFileTimestampIsOlderThanOldFileTimestamp, + MaxParallelism = maxParallelism, + OptimizeForNetworkShares = false, + AutoDetectNetworkShares = false + }.Build(); private FolderDiffService CreateService(ConfigSettings config, ProgressReportService progressReporter, string oldDir, string newDir, string reportDir) { diff --git a/ProgramRunner.cs b/ProgramRunner.cs index a3a136cb..46dd395a 100644 --- a/ProgramRunner.cs +++ b/ProgramRunner.cs @@ -108,13 +108,13 @@ public async Task RunAsync(string[] args) { Console.Beep(); } - #pragma warning disable CA1031 // Beep may throw on platforms without audio support +#pragma warning disable CA1031 // Beep may throw on platforms without audio support catch (PlatformNotSupportedException) { // Console.Beep() is not supported on some platforms (e.g. macOS, some Linux) // BEL character fallback above should still work } - #pragma warning restore CA1031 +#pragma warning restore CA1031 } PromptForExitKeyIfNeeded(opts); @@ -127,7 +127,7 @@ public async Task RunAsync(string[] args) /// private async Task RunWithResultAsync(CliOptions opts) { - #pragma warning disable CA1031 // Top-level application boundary classifies unexpected failures after logging. +#pragma warning disable CA1031 // Top-level application boundary classifies unexpected failures after logging. try { var appVersion = InitializeLoggerAndGetAppVersion(); @@ -191,7 +191,7 @@ private async Task RunWithResultAsync(CliOptions opts) { return CreateFailureResult(ProgramExitCode.UnexpectedError, ex); } - #pragma warning restore CA1031 +#pragma warning restore CA1031 } private string InitializeLoggerAndGetAppVersion() @@ -240,9 +240,9 @@ private static void OutputCompletionSummaryChart(RunCompletionState state) Console.WriteLine(); OutputSummaryBar("Unchanged", state.UnchangedCount, total, null); - OutputSummaryBar("Added", state.AddedCount, total, ConsoleColor.Green); - OutputSummaryBar("Removed", state.RemovedCount, total, ConsoleColor.Red); - OutputSummaryBar("Modified", state.ModifiedCount, total, ConsoleColor.Cyan); + OutputSummaryBar("Added", state.AddedCount, total, ConsoleColor.Green); + OutputSummaryBar("Removed", state.RemovedCount, total, ConsoleColor.Red); + OutputSummaryBar("Modified", state.ModifiedCount, total, ConsoleColor.Cyan); Console.WriteLine(); } diff --git a/Runner/ProgramRunner.OpenFolder.cs b/Runner/ProgramRunner.OpenFolder.cs index 46128cdd..3166890d 100644 --- a/Runner/ProgramRunner.OpenFolder.cs +++ b/Runner/ProgramRunner.OpenFolder.cs @@ -25,7 +25,7 @@ public sealed partial class ProgramRunner /// --open-* 失敗処理向けにロガーをベストエフォートで初期化します。 /// これらのコマンドは通常、ログディレクトリに触れずに終了するため、bootstrap ログはフォルダオープン失敗後にのみ実行されます。 /// - #pragma warning disable CA1031 // Best-effort bootstrap must never leak and override the original open-folder failure. +#pragma warning disable CA1031 // Best-effort bootstrap must never leak and override the original open-folder failure. private bool TryInitializeLoggerForFolderOpen() { try @@ -39,7 +39,7 @@ private bool TryInitializeLoggerForFolderOpen() return false; } } - #pragma warning restore CA1031 +#pragma warning restore CA1031 private void WriteOpenFolderBootstrapError(Exception ex) { @@ -150,7 +150,7 @@ private int OpenFolder(Func resolveFolderPath) Console.Error.WriteLine(string.Format(System.Globalization.CultureInfo.InvariantCulture, ERROR_OPEN_FOLDER_FAILED, folderPath, openStage, ex.GetType().Name, PathShapeDiagnostics.DescribeState("TargetPath", folderPath), ex.Message)); return (int)ProgramExitCode.ExecutionFailed; } - #pragma warning disable CA1031 // Application boundary: catch-all for platform-specific process launch failures +#pragma warning disable CA1031 // Application boundary: catch-all for platform-specific process launch failures catch (Exception ex) { if (TryInitializeLoggerForFolderOpen()) @@ -161,7 +161,7 @@ private int OpenFolder(Func resolveFolderPath) Console.Error.WriteLine(string.Format(System.Globalization.CultureInfo.InvariantCulture, ERROR_OPEN_FOLDER_FAILED, folderPath, openStage, ex.GetType().Name, PathShapeDiagnostics.DescribeState("TargetPath", folderPath), ex.Message)); return (int)ProgramExitCode.ExecutionFailed; } - #pragma warning restore CA1031 +#pragma warning restore CA1031 } } } diff --git a/Runner/RunScopeBuilder.cs b/Runner/RunScopeBuilder.cs index 4be6f635..00b1ced7 100644 --- a/Runner/RunScopeBuilder.cs +++ b/Runner/RunScopeBuilder.cs @@ -85,11 +85,11 @@ internal static ServiceProvider Build(ConfigSettings config, DiffExecutionContex // Built-in disassembler provider (.NET assemblies) // 組み込み逆アセンブラプロバイダ(.NET アセンブリ) - services.AddScoped(sp => - new DotNetDisassemblerProvider( - sp.GetRequiredService(), - sp.GetRequiredService(), - sp.GetRequiredService())); + services.AddScoped(sp => + new DotNetDisassemblerProvider( + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService())); // Register services from loaded plugins / 読み込み済みプラグインからサービスを登録 RegisterPluginServices(services, config, plugins); diff --git a/Services/ConfigService.cs b/Services/ConfigService.cs index 08e1bd63..82a9aa80 100644 --- a/Services/ConfigService.cs +++ b/Services/ConfigService.cs @@ -156,38 +156,38 @@ internal static void ApplyEnvironmentVariableOverrides(ConfigSettingsBuilder con { const string P = ENV_VAR_PREFIX; - TryApplyInt(P + "MAXLOGGENERATIONS", v => config.MaxLogGenerations = v); - TryApplyBool(P + "SHOULDINCLUDEUNCHANGEDFILES", v => config.ShouldIncludeUnchangedFiles = v); - TryApplyBool(P + "SHOULDINCLUDEIGNOREDFILES", v => config.ShouldIncludeIgnoredFiles = v); - TryApplyBool(P + "SHOULDINCLUDEREVIEWCHECKLIST", v => config.ShouldIncludeReviewChecklist = v); - TryApplyBool(P + "SHOULDINCLUDEILCACHESTATSINREPORT", v => config.ShouldIncludeILCacheStatsInReport = v); - TryApplyBool(P + "SHOULDGENERATEHTMLREPORT", v => config.ShouldGenerateHtmlReport = v); - TryApplyBool(P + "SHOULDOUTPUTILTEXT", v => config.ShouldOutputILText = v); - TryApplyBool(P + "SHOULDIGNOREILLINESCONFIGUREDSTRINGS", v => config.ShouldIgnoreILLinesContainingConfiguredStrings = v); - TryApplyBool(P + "SHOULDOUTPUTFILETIMESTAMPS", v => config.ShouldOutputFileTimestamps = v); - TryApplyBool(P + "SHOULDWARNWHENNEWFILETIMESTAMPISOLDER", v => config.ShouldWarnWhenNewFileTimestampIsOlderThanOldFileTimestamp = v); - TryApplyInt(P + "MAXPARALLELISM", v => config.MaxParallelism = v); - TryApplyInt(P + "TEXTDIFFPARALLELTHRESHOLDKILOBYTES", v => config.TextDiffParallelThresholdKilobytes = v); - TryApplyInt(P + "TEXTDIFFCHUNKSIZEKILOBYTES", v => config.TextDiffChunkSizeKilobytes = v); - TryApplyInt(P + "TEXTDIFFPARALLELMEMORYLIMITMEGABYTES", v => config.TextDiffParallelMemoryLimitMegabytes = v); - TryApplyBool(P + "SHOULDTREATTEXTBYTEDIFFERENCESASMISMATCH", v => config.ShouldTreatTextByteDifferencesAsMismatch = v); - TryApplyBool(P + "ENABLEILCACHE", v => config.EnableILCache = v); - TryApplyString(P + "ILCACHEDIRECTORYABSOLUTEPATH", v => config.ILCacheDirectoryAbsolutePath = v); - TryApplyInt(P + "ILCACHESTATSLOGINTERVALSECONDS", v => config.ILCacheStatsLogIntervalSeconds = v); - TryApplyInt(P + "ILCACHEMAXDISKFILECOUNT", v => config.ILCacheMaxDiskFileCount = v); - TryApplyInt(P + "ILCACHEMAXDISKMEGABYTES", v => config.ILCacheMaxDiskMegabytes = v); - TryApplyInt(P + "ILCACHEMAXMEMORYMEGABYTES", v => config.ILCacheMaxMemoryMegabytes = v); - TryApplyInt(P + "ILPRECOMPUTEBATCHSIZE", v => config.ILPrecomputeBatchSize = v); - TryApplyBool(P + "OPTIMIZEFORNETWORKSHARES", v => config.OptimizeForNetworkShares = v); - TryApplyBool(P + "AUTODETECTNETWORKSHARES", v => config.AutoDetectNetworkShares = v); - TryApplyInt(P + "DISASSEMBLERBLACKLISTTTLMINUTES", v => config.DisassemblerBlacklistTtlMinutes = v); - TryApplyBool(P + "SKIPIL", v => config.SkipIL = v); - TryApplyBool(P + "ENABLEINLINEDIFF", v => config.EnableInlineDiff = v); - TryApplyInt(P + "INLINEDIFFCONTEXTLINES", v => config.InlineDiffContextLines = v); - TryApplyInt(P + "INLINEDIFFMAXEDITDISTANCE", v => config.InlineDiffMaxEditDistance = v); - TryApplyInt(P + "INLINEDIFFMAXDIFFLINES", v => config.InlineDiffMaxDiffLines = v); - TryApplyInt(P + "INLINEDIFFMAXOUTPUTLINES", v => config.InlineDiffMaxOutputLines = v); - TryApplyBool(P + "INLINEDIFFLAZYRENDER", v => config.InlineDiffLazyRender = v); + TryApplyInt(P + "MAXLOGGENERATIONS", v => config.MaxLogGenerations = v); + TryApplyBool(P + "SHOULDINCLUDEUNCHANGEDFILES", v => config.ShouldIncludeUnchangedFiles = v); + TryApplyBool(P + "SHOULDINCLUDEIGNOREDFILES", v => config.ShouldIncludeIgnoredFiles = v); + TryApplyBool(P + "SHOULDINCLUDEREVIEWCHECKLIST", v => config.ShouldIncludeReviewChecklist = v); + TryApplyBool(P + "SHOULDINCLUDEILCACHESTATSINREPORT", v => config.ShouldIncludeILCacheStatsInReport = v); + TryApplyBool(P + "SHOULDGENERATEHTMLREPORT", v => config.ShouldGenerateHtmlReport = v); + TryApplyBool(P + "SHOULDOUTPUTILTEXT", v => config.ShouldOutputILText = v); + TryApplyBool(P + "SHOULDIGNOREILLINESCONFIGUREDSTRINGS", v => config.ShouldIgnoreILLinesContainingConfiguredStrings = v); + TryApplyBool(P + "SHOULDOUTPUTFILETIMESTAMPS", v => config.ShouldOutputFileTimestamps = v); + TryApplyBool(P + "SHOULDWARNWHENNEWFILETIMESTAMPISOLDER", v => config.ShouldWarnWhenNewFileTimestampIsOlderThanOldFileTimestamp = v); + TryApplyInt(P + "MAXPARALLELISM", v => config.MaxParallelism = v); + TryApplyInt(P + "TEXTDIFFPARALLELTHRESHOLDKILOBYTES", v => config.TextDiffParallelThresholdKilobytes = v); + TryApplyInt(P + "TEXTDIFFCHUNKSIZEKILOBYTES", v => config.TextDiffChunkSizeKilobytes = v); + TryApplyInt(P + "TEXTDIFFPARALLELMEMORYLIMITMEGABYTES", v => config.TextDiffParallelMemoryLimitMegabytes = v); + TryApplyBool(P + "SHOULDTREATTEXTBYTEDIFFERENCESASMISMATCH", v => config.ShouldTreatTextByteDifferencesAsMismatch = v); + TryApplyBool(P + "ENABLEILCACHE", v => config.EnableILCache = v); + TryApplyString(P + "ILCACHEDIRECTORYABSOLUTEPATH", v => config.ILCacheDirectoryAbsolutePath = v); + TryApplyInt(P + "ILCACHESTATSLOGINTERVALSECONDS", v => config.ILCacheStatsLogIntervalSeconds = v); + TryApplyInt(P + "ILCACHEMAXDISKFILECOUNT", v => config.ILCacheMaxDiskFileCount = v); + TryApplyInt(P + "ILCACHEMAXDISKMEGABYTES", v => config.ILCacheMaxDiskMegabytes = v); + TryApplyInt(P + "ILCACHEMAXMEMORYMEGABYTES", v => config.ILCacheMaxMemoryMegabytes = v); + TryApplyInt(P + "ILPRECOMPUTEBATCHSIZE", v => config.ILPrecomputeBatchSize = v); + TryApplyBool(P + "OPTIMIZEFORNETWORKSHARES", v => config.OptimizeForNetworkShares = v); + TryApplyBool(P + "AUTODETECTNETWORKSHARES", v => config.AutoDetectNetworkShares = v); + TryApplyInt(P + "DISASSEMBLERBLACKLISTTTLMINUTES", v => config.DisassemblerBlacklistTtlMinutes = v); + TryApplyBool(P + "SKIPIL", v => config.SkipIL = v); + TryApplyBool(P + "ENABLEINLINEDIFF", v => config.EnableInlineDiff = v); + TryApplyInt(P + "INLINEDIFFCONTEXTLINES", v => config.InlineDiffContextLines = v); + TryApplyInt(P + "INLINEDIFFMAXEDITDISTANCE", v => config.InlineDiffMaxEditDistance = v); + TryApplyInt(P + "INLINEDIFFMAXDIFFLINES", v => config.InlineDiffMaxDiffLines = v); + TryApplyInt(P + "INLINEDIFFMAXOUTPUTLINES", v => config.InlineDiffMaxOutputLines = v); + TryApplyBool(P + "INLINEDIFFLAZYRENDER", v => config.InlineDiffLazyRender = v); } private static void TryApplyInt(string envVarName, Action apply) diff --git a/Services/HtmlReport/HtmlReportGenerateService.DetailRows.cs b/Services/HtmlReport/HtmlReportGenerateService.DetailRows.cs index e3ef8fa7..870bc5a3 100644 --- a/Services/HtmlReport/HtmlReportGenerateService.DetailRows.cs +++ b/Services/HtmlReport/HtmlReportGenerateService.DetailRows.cs @@ -29,10 +29,10 @@ private void AppendInlineDiffRow( ILCache? ilCache, string sectionPrefix = "mod") { - int maxDiffLines = config.InlineDiffMaxDiffLines > 0 ? config.InlineDiffMaxDiffLines : 10000; - int maxOutput = config.InlineDiffMaxOutputLines > 0 ? config.InlineDiffMaxOutputLines : 10000; - int contextLines = config.InlineDiffContextLines >= 0 ? config.InlineDiffContextLines : 0; - int maxEditDistance = config.InlineDiffMaxEditDistance > 0 ? config.InlineDiffMaxEditDistance : 4000; + int maxDiffLines = config.InlineDiffMaxDiffLines > 0 ? config.InlineDiffMaxDiffLines : 10000; + int maxOutput = config.InlineDiffMaxOutputLines > 0 ? config.InlineDiffMaxOutputLines : 10000; + int contextLines = config.InlineDiffContextLines >= 0 ? config.InlineDiffContextLines : 0; + int maxEditDistance = config.InlineDiffMaxEditDistance > 0 ? config.InlineDiffMaxEditDistance : 4000; int recordNo = idx + 1; var (oldLines, newLines) = ReadInlineDiffSourceLines(relPath, oldFolderAbsolutePath, newFolderAbsolutePath, reportsFolderAbsolutePath, diffDetail); diff --git a/Services/HtmlReport/HtmlReportGenerateService.Helpers.cs b/Services/HtmlReport/HtmlReportGenerateService.Helpers.cs index b182cc3a..971742e2 100644 --- a/Services/HtmlReport/HtmlReportGenerateService.Helpers.cs +++ b/Services/HtmlReport/HtmlReportGenerateService.Helpers.cs @@ -68,10 +68,10 @@ private static void AppendFileRow( string sdk = "", bool includeIlPathCopy = false) { - string cbId = $"cb_{sectionPrefix}_{idx}"; + string cbId = $"cb_{sectionPrefix}_{idx}"; string reasonId = $"reason_{sectionPrefix}_{idx}"; - string notesId = $"notes_{sectionPrefix}_{idx}"; - int recordNo = idx + 1; + string notesId = $"notes_{sectionPrefix}_{idx}"; + int recordNo = idx + 1; string impAttr = string.IsNullOrEmpty(importance) ? "" : $" data-importance=\"{HtmlEncode(importance)}\""; // All distinct importance levels for filtering (comma-separated) // フィルタリング用の全重要度レベル(カンマ区切り) diff --git a/Services/HtmlReport/HtmlReportGenerateService.Sections.cs b/Services/HtmlReport/HtmlReportGenerateService.Sections.cs index 1825918d..ce1ba32c 100644 --- a/Services/HtmlReport/HtmlReportGenerateService.Sections.cs +++ b/Services/HtmlReport/HtmlReportGenerateService.Sections.cs @@ -323,7 +323,7 @@ private void AppendWarningsSection( ILCache? ilCache) { bool hasSha256 = _fileDiffResultLists.HasAnySha256Mismatch; - bool hasTs = _fileDiffResultLists.HasAnyNewFileTimestampOlderThanOldWarning; + bool hasTs = _fileDiffResultLists.HasAnyNewFileTimestampOlderThanOldWarning; bool hasILFilter = _fileDiffResultLists.HasAnyILFilterWarning; if (!hasSha256 && !hasTs && !hasILFilter) return; diff --git a/Services/HtmlReportGenerateService.cs b/Services/HtmlReportGenerateService.cs index 7e5fe949..51a212d2 100644 --- a/Services/HtmlReportGenerateService.cs +++ b/Services/HtmlReportGenerateService.cs @@ -28,13 +28,13 @@ public sealed partial class HtmlReportGenerateService private const string TIMESTAMP_ARROW = " → "; // CSS variable references for dark mode support / ダークモード対応の CSS 変数参照 - private const string COLOR_ADDED = "var(--color-added)"; - private const string COLOR_REMOVED = "var(--color-removed)"; + private const string COLOR_ADDED = "var(--color-added)"; + private const string COLOR_REMOVED = "var(--color-removed)"; private const string COLOR_MODIFIED = "var(--color-modified)"; - private const string TH_BG_ADDED = "var(--color-added-bg)"; - private const string TH_BG_REMOVED = "var(--color-removed-bg)"; + private const string TH_BG_ADDED = "var(--color-added-bg)"; + private const string TH_BG_REMOVED = "var(--color-removed-bg)"; private const string TH_BG_MODIFIED = "var(--color-modified-bg)"; - private const string TH_BG_DEFAULT = "var(--color-default-bg)"; + private const string TH_BG_DEFAULT = "var(--color-default-bg)"; /// /// Initializes a new instance of . diff --git a/Services/LoggerService.cs b/Services/LoggerService.cs index 566ad594..022252cb 100644 --- a/Services/LoggerService.cs +++ b/Services/LoggerService.cs @@ -22,9 +22,9 @@ public sealed class LoggerService : ILoggerService { private const string LOGS_DIRECTORY_NAME = "Logs"; private const string LOG_FILE_PREFIX = "log_"; - private const string LOG_PREFIX_INFO = "[INF]"; + private const string LOG_PREFIX_INFO = "[INF]"; private const string LOG_PREFIX_WARNING = "[WRN]"; - private const string LOG_PREFIX_ERROR = "[ERR]"; + private const string LOG_PREFIX_ERROR = "[ERR]"; /// /// Lock object for serialising file writes so that concurrent callers do not cause IOException. diff --git a/global.json b/global.json index 989a69ca..1d83cf1a 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,7 @@ { "sdk": { - "version": "8.0.100", - "rollForward": "latestMinor" + "version": "8.0.413", + "rollForward": "disable", + "allowPrerelease": false } -} \ No newline at end of file +} From 697300517d41437377453c8c4a3cfa743e0830ce Mon Sep 17 00:00:00 2001 From: Widthdom Date: Sat, 25 Jul 2026 17:04:10 +0900 Subject: [PATCH 2/2] Pin latest .NET 8 SDK --- .../Architecture/CiAutomationConfigurationTests.cs | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs b/FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs index d966f011..dffbe30c 100644 --- a/FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs +++ b/FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs @@ -64,7 +64,7 @@ public void FormattingBaseline_PinsSdkAndIsEnforcedByCi() var globalJson = JsonDocument.Parse(File.ReadAllText(GetRepositoryFilePath("global.json"))).RootElement; var sdk = globalJson.GetProperty("sdk"); - Assert.Equal("8.0.413", sdk.GetProperty("version").GetString()); + Assert.Equal("8.0.423", sdk.GetProperty("version").GetString()); Assert.Equal("disable", sdk.GetProperty("rollForward").GetString()); Assert.False(sdk.GetProperty("allowPrerelease").GetBoolean()); Assert.Contains("global-json-file: global.json", workflow, StringComparison.Ordinal); diff --git a/global.json b/global.json index 1d83cf1a..5be7a226 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.413", + "version": "8.0.423", "rollForward": "disable", "allowPrerelease": false }