Linting & formatting: adopt a modern .NET analyzer/formatter stack #20
Labels
No labels
alpha:wave-0
alpha:wave-1
alpha:wave-2
alpha:wave-3
area:assets
area:combat
area:ecology
area:infra
area:render
area:scripting
area:ui
area:world
enhancement
epic
migration
post-alpha
roadmap
tech-debt
type:bug
type:chore
type:design
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
marco/IsoMmo#20
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Adopt modern, community-standard linting/formatting for the whole .NET solution, enforced consistently (locally + CI). We already run
TreatWarningsAsErrors=trueviaDirectory.Build.props— this issue layers real analyzers + a formatter on top so style/quality issues are caught mechanically, not in review.The modern accepted stack (proposal)
.editorconfigat the repo root — the standard, tool-agnostic config; Roslyn analyzers anddotnet formatboth honor it. Single source of truth for style.EnableNETAnalyzers=true+AnalysisMode(Recommended→All) inDirectory.Build.props. Zero extra deps, official.dotnet format— official formatter; CI gate viadotnet format --verify-no-changes. Localjust format/just lint.dotnet format+.editorconfig.All of the above are pure .NET/NuGet and cross-platform — no OS lock-in (respects the multi-platform hard requirement).
Hidden complexity / risks
.editorconfig), then ratchet severity up — not a big-bang flip..editorconfig+Directory.Build.props) per our "config in exactly one place" rule.Scope
.editorconfigencoding our C# style (file-scoped namespaces,sealeddefault, collection expressions, naming, etc.).Directory.Build.props.just format(apply) andjust lint(verify) recipes.Definition of Done
Base DoD applies on top (tests green, whole solution builds, zero warnings, multi-platform preserved).
dotnet format --verify-no-changespasses on a clean checkout of the whole solution.just lintreproduces the CI check locally;just formatfixes formatting..editorconfig.Open decisions
dotnet format+.editorconfig?AnalysisMode: Recommended (ease in) vs All (strict from day one, more upfront fixing)?Implemented on branch chore/linting.
Stack: CSharpier (formatter, local dotnet tool) + built-in .NET analyzers (AnalysisMode=Recommended) + Roslynator.Analyzers + SonarAnalyzer.CSharp, all enforced at build under the existing TreatWarningsAsErrors. Tool 'dotnet-ef' (version '10.0.10') was restored. Available commands: dotnet-ef
Tool 'csharpier' (version '1.3.0') was restored. Available commands: csharpier
Restore was successful.
Formatted 127 files in 248ms. (CSharpier) and Tool 'dotnet-ef' (version '10.0.10') was restored. Available commands: dotnet-ef
Tool 'csharpier' (version '1.3.0') was restored. Available commands: csharpier
Restore was successful.
Checked 127 files in 225ms.
Determining projects to restore...
All projects are up-to-date for restore.
IsoMmo.Assets -> /Users/marco/Development/IsoMmo/src/IsoMmo.Assets/bin/Debug/net10.0/IsoMmo.Assets.dll
IsoMmo.Shared -> /Users/marco/Development/IsoMmo/src/IsoMmo.Shared/bin/Debug/net10.0/IsoMmo.Shared.dll
IsoMmo.Shared -> /Users/marco/Development/IsoMmo/src/IsoMmo.Shared/bin/Debug/net8.0/IsoMmo.Shared.dll
IsoMmo.Assets.Tests -> /Users/marco/Development/IsoMmo/tests/IsoMmo.Assets.Tests/bin/Debug/net10.0/IsoMmo.Assets.Tests.dll
IsoMmo.Shared.Tests -> /Users/marco/Development/IsoMmo/tests/IsoMmo.Shared.Tests/bin/Debug/net10.0/IsoMmo.Shared.Tests.dll
IsoMmo.Client.Core -> /Users/marco/Development/IsoMmo/client/IsoMmo.Client.Core/bin/Debug/net10.0/IsoMmo.Client.Core.dll
IsoMmo.AssetEditor -> /Users/marco/Development/IsoMmo/tools/IsoMmo.AssetEditor/bin/Debug/net10.0/IsoMmo.AssetEditor.dll
IsoMmo.AssetExtractor -> /Users/marco/Development/IsoMmo/tools/IsoMmo.AssetExtractor/bin/Debug/net10.0/IsoMmo.AssetExtractor.dll
IsoMmo.AssetExtractor.Tests -> /Users/marco/Development/IsoMmo/tests/IsoMmo.AssetExtractor.Tests/bin/Debug/net10.0/IsoMmo.AssetExtractor.Tests.dll
IsoMmo.Auth -> /Users/marco/Development/IsoMmo/src/IsoMmo.Auth/bin/Debug/net10.0/IsoMmo.Auth.dll
IsoMmo.Client.Core.Tests -> /Users/marco/Development/IsoMmo/tests/IsoMmo.Client.Core.Tests/bin/Debug/net10.0/IsoMmo.Client.Core.Tests.dll
IsoMmo.Client -> /Users/marco/Development/IsoMmo/client/IsoMmo.Client/bin/Debug/net10.0/IsoMmo.Client.dll
IsoMmo.GameServer -> /Users/marco/Development/IsoMmo/src/IsoMmo.GameServer/bin/Debug/net10.0/IsoMmo.GameServer.dll
IsoMmo.Auth.Tests -> /Users/marco/Development/IsoMmo/tests/IsoMmo.Auth.Tests/bin/Debug/net10.0/IsoMmo.Auth.Tests.dll
IsoMmo.GameServer.Tests -> /Users/marco/Development/IsoMmo/tests/IsoMmo.GameServer.Tests/bin/Debug/net10.0/IsoMmo.GameServer.Tests.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.53 (CSharpier check + analyzer build) are the gates; CI hookup deferred to a later issue.
Phased, reasoned policy (root .editorconfig): ~380 initial findings triaged by judgment, not blanket-ignored.
Build green with warnings-as-errors, 161 tests pass. AnalysisMode can be raised (Recommended→All) and suggestions promoted to warnings as we ratchet up.