Need & Action (Bedarf & Handlung)
Need: The project layout should be self-describing: a reader (and tooling) should be able to
locate any type from its name and namespace alone. Today nothing enforces that types, files, folders
and namespaces stay aligned, so the tree drifts over time.
Action: Ship the first three NetEvolve.Analyzer rules — all in the Maintainability category —
that enforce file/type/namespace organization, each with an optional code fix where feasible.
| ID |
Rule |
Code fix |
| NE0001 (#3) |
One top-level type per file; file name equals type name (generic-overload exception) |
Move type to own file / rename file |
| NE0002 (#4) |
Namespace must match the folder structure relative to RootNamespace |
Adjust namespace |
| NE0003 (#5) |
Only one namespace declaration per file |
— (diagnostic only, fix TBD) |
Sub-issues:
Impact
- Maintainability & discoverability: predictable file locations, smaller diffs, easier reviews.
- Onboarding cost: a one-time, potentially large churn on existing code bases when first enabled —
mitigated by code fixes and the opt-outs below.
- Consistency with prior art: overlaps conceptually with Roslyn
IDE0130, StyleCop SA1649/SA1402
and Meziantou MA0048; this package unifies them under one configurable, RootNamespace-aware surface.
Global configuration (applies to all three rules)
- Single-file deployment auto-off: the analyzer reads the MSBuild property
PublishSingleFile
(exposed via CompilerVisibleProperty). When true, all three rules stay silent — one-type-per-file
is meaningless for a single-file publish.
- Explicit override:
NetEvolveAnalyzerDisableFileOrganizationRules (bool, default false) force-disables
all three regardless of PublishSingleFile.
Definition of Done
Follow-ups
Need & Action (Bedarf & Handlung)
Need: The project layout should be self-describing: a reader (and tooling) should be able to
locate any type from its name and namespace alone. Today nothing enforces that types, files, folders
and namespaces stay aligned, so the tree drifts over time.
Action: Ship the first three
NetEvolve.Analyzerrules — all in the Maintainability category —that enforce file/type/namespace organization, each with an optional code fix where feasible.
RootNamespaceSub-issues:
Impact
mitigated by code fixes and the opt-outs below.
IDE0130, StyleCopSA1649/SA1402and Meziantou
MA0048; this package unifies them under one configurable,RootNamespace-aware surface.Global configuration (applies to all three rules)
PublishSingleFile(exposed via
CompilerVisibleProperty). Whentrue, all three rules stay silent — one-type-per-fileis meaningless for a single-file publish.
NetEvolveAnalyzerDisableFileOrganizationRules(bool, defaultfalse) force-disablesall three regardless of
PublishSingleFile.Definition of Done
src/NetEvolve.Analyzer/Maintainability/Verifiers/) + integration tests (AnalyzerCompiler)DiagnosticIds.csandAnalyzerReleases.Unshipped.mddocs/rules/NE000x.mdFollow-ups