mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
- 新增 analyzer-warning-reduction topic 的 active 与 archive 恢复入口 - 归档 local-plan 中的 RP-001 tracking 和 trace 历史并移除旧目录 - 更新公共索引与 ai-plan-governance 记录并补充迁移验证
12 KiB
12 KiB
Analyzer Warning Reduction History
该文档于
2026-04-19从旧local-plan/todos/analyzer-warning-reduction-tracking.md迁入,作为ANALYZER-WARNING-REDUCTION-RP-001的历史跟踪归档保留。
Legacy Tracking Content
Goal
Reduce the currently surfaced Meziantou analyzer warnings from the repository build by prioritizing low-risk, behavior-preserving fixes first, then reassessing whether larger refactors are justified for remaining long-method and file-structure warnings.
Current Recovery Point
- Recovery point:
ANALYZER-WARNING-REDUCTION-RP-001 - Current phase:
Phase 1 - Active focus:
- capture the current warning clusters with
dotnet build ... -t:Rebuild -clp:Summary;WarningsOnly - fix low-risk runtime and generator warnings that do not require architectural rewrites
- keep this tracking document and the paired trace synchronized with subagent scope, accepted fixes, and validation
- keep the current checkpoint test-green for the targeted regressions introduced by warning-reduction edits
- capture the current warning clusters with
Planned Work
- Read
AGENTS.mdand.ai/environment/tools.ai.yamlbefore choosing commands. - Confirm the current warning set still reproduces in a clean rebuild-oriented build invocation.
- Group warnings into independent work slices before delegating.
- Record delegated ownership boundaries for parallel subagent work.
- Reduce low-risk warnings in
GFramework.Core/GFramework.Cqrs. - Reduce low-risk warnings in
GFramework.Godot. - Reduce low-risk warnings in source generator projects without broad generator rewrites.
- Rebuild the affected projects and record the remaining warning hotspots.
- Repair the targeted test regressions introduced by the current warning-reduction checkpoint.
- Apply the current CodeRabbit follow-up fixes for module-install ordering, logging factory null-safety/disposal, and Godot YAML directory enumeration contracts.
- Apply the latest CodeRabbit follow-up fixes for failure-path module tracking, logger-name validation, and brittle test replacement.
- Apply the latest CodeRabbit follow-up fixes for null appender-entry validation and async doc-sample correctness.
- Decide whether any remaining
MA0051/ file-structure warnings are safe to tackle in the same round.
Validation
Planned validation commands:
dotnet build GFramework.sln -c Release -t:Rebuild -nologo -clp:Summary;WarningsOnly
dotnet build GFramework.Core/GFramework.Core.csproj -c Release -t:Rebuild -nologo -clp:Summary;WarningsOnly
dotnet build GFramework.Godot/GFramework.Godot.csproj -c Release -t:Rebuild -nologo -clp:Summary;WarningsOnly
dotnet build GFramework.Core.SourceGenerators/GFramework.Core.SourceGenerators.csproj -c Release -t:Rebuild -nologo -clp:Summary;WarningsOnly
Results:
dotnet build GFramework.Core.SourceGenerators/GFramework.Core.SourceGenerators.csproj -c Release --no-restore- passed with
0 Warning(s)and0 Error(s).
- passed with
dotnet build GFramework.Cqrs/GFramework.Cqrs.csproj -c Release -t:Rebuild --no-restore -p:TargetFramework=net8.0 -p:UseSharedCompilation=false -nologo -clp:Summary;WarningsOnly- passed with
1 Warning(s)and0 Error(s). - remaining warning:
GFramework.Cqrs/Internal/CqrsHandlerRegistrar.csMA0051long-method warning.
- passed with
dotnet build GFramework.Core/GFramework.Core.csproj -c Release -t:Rebuild --no-restore -p:UseSharedCompilation=false -p:TargetFramework=net8.0 -nologo -clp:Summary;WarningsOnly- first focused rebuild after the initial runtime-fix pass:
49 Warning(s),0 Error(s). - latest focused rebuild after the follow-up structural cleanup:
31 Warning(s),0 Error(s). - the remaining
net8.0warnings are now concentrated in:- generic/non-generic file-name collisions that cannot be fixed cheaply without API renames
- delegate-shape rules around specific callbacks
- a smaller set of long-method warnings
- a few collection-abstraction warnings on public configuration types
- first focused rebuild after the initial runtime-fix pass:
dotnet build GFramework.Godot/GFramework.Godot.csproj -c Release --no-restore -p:TargetFramework=net8.0 -p:UseSharedCompilation=false- worker validation reported a successful build after the Godot-owned fixes.
- remaining Godot-owned warnings reported by the worker:
GFramework.Godot/Setting/Data/LocalizationMap.csMA0016on the two publicDictionary-typed properties.
- broader direct
GFramework.Godotbuilds still surface manyGFramework.Gamedependency warnings, so those results should not be interpreted as unresolved Godot-owned work.
dotnet test GFramework.Core.Tests -c Release --filter "FullyQualifiedName~GetString_WithUnknownCompactFormatterArgs_ShouldIgnoreUnknownOptions|FullyQualifiedName~GetString_WithVariable_ShouldFormatCorrectly|FullyQualifiedName~GetString_WithMultipleVariables_ShouldFormatCorrectly|FullyQualifiedName~GetString_WithInvalidCompactFormatterArgs_ShouldFallbackToDefaultFormatting|FullyQualifiedName~GetString_WithCompactFormatterArgs_ShouldApplyOptions|FullyQualifiedName~GetString_WithCompactFormatter_ShouldFormatCorrectly|FullyQualifiedName~Ensure_Should_Create_ArgumentException_With_Message|FullyQualifiedName~RegisterCqrsHandlersFromAssemblies_WithNullAssemblyItem_Should_ThrowArgumentNullException"- passed with
0 Failed,8 Passed,0 Skipped. - regressions fixed in this validation step:
LocalizationStringplaceholder formatting stopped replacing values after the regex switched toRegexOptions.ExplicitCapturewhile still reading unnamed capture groups.ResultExtensions.Ensurechanged the observableArgumentException.Messageby adding a parameter name.MicrosoftDiContainer.RegisterCqrsHandlersFromAssemblieschanged the null-item contract fromArgumentNullExceptiontoArgumentException.
- passed with
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~NumericExtensionsTests|FullyQualifiedName~ResultTests|FullyQualifiedName~ResultExtensionsTests|FullyQualifiedName~LoggingConfigurationTests"- passed with
0 Failed,101 Passed,0 Skipped. - covered the new review-driven fixes for:
NumericExtensions.Betweennull contract enforcementResultdefault-value safety inEquals/GetHashCode/ToStringResultExtensions.Ensureparameter-name contractConfigurableLoggerFactorylongest-prefix logger-level selection
- passed with
dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~SettingsSystemTests|FullyQualifiedName~GodotLocalizationSettingsTests"- passed with
0 Failed,7 Passed,0 Skipped. - revalidated the
IApplyAbleSettings.ApplyAsyncrename through system and Godot localization callers.
- passed with
dotnet build GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release- passed with
0 Error(s).
- passed with
dotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~LoadAsync_Should_Use_Globalized_Res_Directory_Directly_When_Running_In_Editor"- passed with
0 Failed,1 Passed,0 Skipped. - used as the stable Godot-side smoke test after the review-driven changes to
SceneBehaviorBase,AbstractArchitecture, andGodotYamlConfigEnvironment.
- passed with
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~ConfigurableLoggerFactoryTests|FullyQualifiedName~LoggingConfigurationTests"- narrowed to
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~ConfigurableLoggerFactoryTests" -m:1 - passed with
0 Failed,3 Passed,0 Skipped.
- narrowed to
dotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~LoadAsync_Should_Use_Globalized_Res_Directory_Directly_When_Running_In_Editor"- passed with
0 Failed,1 Passed,0 Skipped.
- passed with
dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~GodotLocalizationSettingsTests"- passed with
0 Failed,3 Passed,0 Skipped.
- passed with
dotnet build GFramework.sln -c Release- rerun serially as
dotnet build GFramework.sln -c Release -m:1 - passed with
698 Warning(s)and0 Error(s).
- rerun serially as
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~ConfigurableLoggerFactoryTests" -m:1- latest follow-up rerun passed with
0 Failed,5 Passed,0 Skipped.
- latest follow-up rerun passed with
dotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~AbstractArchitectureModuleInstallationTests" -m:1- passed with
0 Failed,1 Passed,0 Skipped. - now directly covers the contract that
InstallGodotModulethrows beforemodule.Install(...)when_anchoris unavailable.
- passed with
dotnet build GFramework.sln -c Release -m:1- latest follow-up rerun passed with
847 Warning(s)and0 Error(s).
- latest follow-up rerun passed with
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~ConfigurableLoggerFactoryTests" -m:1- latest null-appender validation rerun passed with
0 Failed,6 Passed,0 Skipped.
- latest null-appender validation rerun passed with
dotnet build GFramework.Core/GFramework.Core.csproj -c Release -m:1- latest focused release build passed with
79 Warning(s)and0 Error(s).
- latest focused release build passed with
Known Risks
- Many warnings are duplicated across target frameworks, so a small source edit can remove multiple reported instances; warning counts must be interpreted by unique source location, not only raw line count.
- Some warning families such as
MA0158(System.Threading.Lock) are not obviously safe in the current multi-targetednet8.0;net9.0;net10.0runtime modules and may require conditional compilation or a broader policy decision. - Several
MA0051findings sit in very large files such asSchemaConfigGenerator.csandYamlConfigLoaderTests.cs; these may require more refactoring than is appropriate for a warning-reduction pass. - A subset of the remaining
MA0048warnings come from generic/non-generic type families that share the same base type name, so the analyzer cannot be satisfied by a trivial file move alone. - The current checkpoint has only been revalidated against the eight known regression tests above; a broader test rerun is still pending if the next batch expands the edit surface again.
- The
GodotYamlConfigEnvironmentdefault-directory enumeration fix depends on host file-system and Godot native API behavior; if a deterministic unit test cannot be kept stable in this WSL test host, retain build plus loader-smoke validation and document the gap explicitly. - The
AbstractArchitecture.InstallGodotModuleordering fix can be asserted in pure managed code, but attempting to exerciseAbstractArchitecture.Initialize()directly in the current Godot test host crashes the native test process. Keep this fix covered by project build plus adjacent Godot smoke tests unless a more stable harness is introduced. - The install-ordering regression is now covered by a stable direct-call Godot test. The destroy-observation path still
lacks a dedicated automated assertion because intercepting
GD.PushErrorreliably in the current .NET test host is not yet practical. - Parallel
dotnet test/dotnet buildexecutions against the Windows-backed worktree still trigger transientobj/binfile-lock failures; keep validation serial with-m:1in this environment. - A direct Godot test that calls
GodotYamlConfigEnvironment.Default.ReadAllBytes("res://missing")currently crashes the .NET test host in this environment, so the missing-file contract fix for the default Godot file API path is covered by code review plus project build and adjacent loader tests rather than a dedicated failing-path unit test.
Recommended Resume Step
- Continue from
ANALYZER-WARNING-REDUCTION-RP-001only if the next batch is willing to take on structural fixes such as long-method splits, delegate-shape rewrites, or public configuration-surface refactors. - Preserve the review-follow-up contracts now covered by tests:
NumericExtensions.Betweennull checking,Resultdefault-value safety, longest-prefix logger-level selection, and theIApplyAbleSettings.ApplyAsyncrename. - If the next batch wants stronger Godot validation for missing-path reads, investigate a harness that can safely
exercise
FileAccess.GetFileAsBytesfailure paths without crashing the test host before adding a dedicated test.