feat: share file assembly and generalize the sequential Fix-All provider - #28
Conversation
FolderNamespace.TryResolve no longer requires RootNamespace. When it is absent or empty, the expected namespace is composed from the folder segments below the project directory on their own. A file in the project root with no RootNamespace anchor has nothing to compose from, so the rule stays silent there.
…rovider Extract the file-scoped-namespace assembly shared by the NE0001 move-type and NE0003 flatten fixes into NetEvolve.Analyzer.Builders.NamespaceFileBuilder, removing the duplication between the two code fixes. Rename OneTypePerFileFixAllProvider to SequentialFixAllProvider and move it to NetEvolve.Analyzer.Providers. It is now analyzer- and code-fix-agnostic: the code fix and diagnostic ids come from the FixAllContext, and the analyzer used to re-resolve between steps is supplied per rule through the constructor. Both NE0001 and NE0003 now share it, so NE0003 gains batch Fix-All. Each rule owns a lazily created, thread-safe instance.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #28 +/- ##
==========================================
+ Coverage 97.71% 98.09% +0.37%
==========================================
Files 10 11 +1
Lines 525 524 -1
Branches 106 102 -4
==========================================
+ Hits 513 514 +1
Misses 1 1
+ Partials 11 9 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Reorganizes the file-organization code-fix infrastructure into shared, reusable pieces and extends the folder-derived namespace mapping.
NE0002 — folder-derived namespace when
RootNamespaceis emptyFolderNamespace.TryResolveno longer requiresRootNamespace. When it is absent or empty, the expected namespace is composed from the folder segments below the project directory on their own (e.g.Shapes/Primitives/Circle.cs→Shapes.Primitives). A file in the project root with noRootNamespaceanchor has nothing to compose from, so the rule stays silent there.Shared file assembly
The logic that builds a new file-scoped-namespace file from a set of top-level types — duplicated between the NE0001 move-type fix and the NE0003 flatten fix — is extracted into
NetEvolve.Analyzer.Builders.NamespaceFileBuilder.Generalized sequential Fix-All
OneTypePerFileFixAllProvideris renamed toSequentialFixAllProviderand moved toNetEvolve.Analyzer.Providers. It is now analyzer- and code-fix-agnostic:FixAllContext;Both NE0001 and NE0003 now share it, so NE0003 gains batch Fix-All. Each rule owns a lazily created, thread-safe (
LazyThreadSafetyMode.ExecutionAndPublication) instance.Testing
dotnet build Analyzer.slnx -c Release— clean (0 warnings; strictAnalysisMode=All+ warnings-as-errors).dotnet test Analyzer.slnx -c Release— 134/134 pass, including the NE0003 Fix-All path now exercised end-to-end through the code-fix verifier.FolderNamespaceunit tests for the empty/missing-RootNamespacecases.