Skip to content

feat: share file assembly and generalize the sequential Fix-All provider - #28

Merged
samtrion merged 2 commits into
mainfrom
feat/shared-fix-all-and-folder-namespace
Aug 3, 2026
Merged

feat: share file assembly and generalize the sequential Fix-All provider#28
samtrion merged 2 commits into
mainfrom
feat/shared-fix-all-and-folder-namespace

Conversation

@samtrion

@samtrion samtrion commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Reorganizes the file-organization code-fix infrastructure into shared, reusable pieces and extends the folder-derived namespace mapping.

NE0002 — folder-derived namespace when RootNamespace is empty

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 (e.g. Shapes/Primitives/Circle.csShapes.Primitives). A file in the project root with no RootNamespace anchor 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

OneTypePerFileFixAllProvider is renamed to SequentialFixAllProvider and moved to NetEvolve.Analyzer.Providers. It is now analyzer- and code-fix-agnostic:

  • the code fix to run and the diagnostic ids to match come from the FixAllContext;
  • the analyzer used to re-resolve diagnostics 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 (LazyThreadSafetyMode.ExecutionAndPublication) instance.

Testing

  • dotnet build Analyzer.slnx -c Release — clean (0 warnings; strict AnalysisMode=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.
  • Added FolderNamespace unit tests for the empty/missing-RootNamespace cases.

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.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • state:ready for merge

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3694b198-7197-439a-bcf3-da7f4fce3bb0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.52941% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.09%. Comparing base (1430596) to head (05d8829).

Files with missing lines Patch % Lines
...etEvolve.Analyzer/Builders/NamespaceFileBuilder.cs 95.45% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samtrion
samtrion merged commit 3615360 into main Aug 3, 2026
9 checks passed
@samtrion
samtrion deleted the feat/shared-fix-all-and-folder-namespace branch August 3, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant