build: static-analysis pack foundation at suggestion (#15, increment 1) #26

Merged
timothy merged 1 commits from foundations/15-lint-stack into main 2026-06-27 09:37:15 +02:00
Owner

Refs #15increment 1 of the incremental analyzer rollout (the issue stays open for promotions). Zero source/code churn; build-config only.

What

  • Adds Roslynator, SonarAnalyzer.CSharp, Meziantou.Analyzer, AsyncFixer as central analyzer references (Directory.Build.targets, CPM-versioned, guarded on ManagePackageVersionsCentrally so the gitignored .mcp tool isn't pulled in).
  • .editorconfig defaults dotnet_analyzer_diagnostic.severity = suggestion → packs surface findings without breaking the TreatWarningsAsErrors build. Promotion is the enforcement: raising a rule to warning makes it a CI-blocking error via the existing TWAE build — no new lint step needed.

Deliberate calls (deviations stated)

  • StyleCop excluded: latest stable 1.1.118 crashes (AD0001) on C# records and overlaps the existing .editorconfig/Roslynator. Revisit via 1.2.0-beta only if wanted.
  • Blazor .razor: editorconfig severity overrides don't reach analyzer diagnostics in Razor @code (source-generator limitation — confirmed [*.razor] sections and dotnet format both no-op). The currently-firing Sonar rules (374 findings / 85 files) are temporarily NoWarn-ed in ErsatzTV.csproj and burned down rule-by-rule in #25. The same rules run at suggestion on .cs.
  • Formatting normalization deferred to its own PR (mixed UTF-8 BOM + whitespace; ~1,500 + ~480) — kept out of here to stay reviewable.

Verification

  • Full-solution Release build (TWAE on) → 0 errors, 0 warnings.
  • No .cs/.razor source changed, so runtime behavior/tests are unaffected (PR test job confirms).

Follow-ups

  • #25 — burn down the suppressed .razor Sonar rules (incremental).
  • Formatting normalization PR + dotnet format --verify-no-changes CI gate.
  • Promote curated high-value rules suggestion→warning (next #15 increments).
Refs #15 — **increment 1 of the incremental analyzer rollout** (the issue stays open for promotions). Zero source/code churn; build-config only. ## What - Adds **Roslynator**, **SonarAnalyzer.CSharp**, **Meziantou.Analyzer**, **AsyncFixer** as central analyzer references (`Directory.Build.targets`, CPM-versioned, guarded on `ManagePackageVersionsCentrally` so the gitignored `.mcp` tool isn't pulled in). - `.editorconfig` defaults `dotnet_analyzer_diagnostic.severity = suggestion` → packs surface findings **without breaking the `TreatWarningsAsErrors` build**. **Promotion is the enforcement**: raising a rule to `warning` makes it a CI-blocking error via the existing TWAE build — no new lint step needed. ## Deliberate calls (deviations stated) - **StyleCop excluded**: latest *stable* `1.1.118` crashes (`AD0001`) on C# `record`s and overlaps the existing `.editorconfig`/Roslynator. Revisit via `1.2.0-beta` only if wanted. - **Blazor `.razor`**: editorconfig severity overrides don't reach analyzer diagnostics in Razor `@code` (source-generator limitation — confirmed `[*.razor]` sections and `dotnet format` both no-op). The currently-firing Sonar rules (374 findings / 85 files) are temporarily `NoWarn`-ed in `ErsatzTV.csproj` and **burned down rule-by-rule in #25**. The same rules run at `suggestion` on `.cs`. - **Formatting normalization deferred** to its own PR (mixed UTF-8 BOM + whitespace; ~1,500 + ~480) — kept out of here to stay reviewable. ## Verification - Full-solution Release build (TWAE on) → **0 errors, 0 warnings**. - No `.cs`/`.razor` source changed, so runtime behavior/tests are unaffected (PR `test` job confirms). ## Follow-ups - **#25** — burn down the suppressed `.razor` Sonar rules (incremental). - Formatting normalization PR + `dotnet format --verify-no-changes` CI gate. - Promote curated high-value rules suggestion→warning (next #15 increments).
timothy added 1 commit 2026-06-27 09:30:08 +02:00
build: adopt static-analysis packs at suggestion (#15, increment 1)
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 2m25s
9ffb2b6a67
Add Roslynator, SonarAnalyzer.CSharp, Meziantou.Analyzer, and AsyncFixer as central
analyzer references (Directory.Build.targets, CPM-versioned, guarded on
ManagePackageVersionsCentrally so the gitignored .mcp tool isn't affected).
.editorconfig defaults dotnet_analyzer_diagnostic.severity to `suggestion` so the packs
surface findings without failing the TreatWarningsAsErrors (TWAE) build; rules are
promoted to warning/error incrementally (promotion = enforcement via the existing TWAE
build, so no separate lint step is needed).

StyleCop.Analyzers is intentionally excluded: its latest stable (1.1.118) crashes
(AD0001) on C# records and overlaps the existing .editorconfig/Roslynator.

Blazor .razor: editorconfig severity overrides don't reach analyzer diagnostics in Razor
@code (source-generator limitation; dotnet format can't fix them either), so the
currently-firing SonarAnalyzer rules are temporarily NoWarn-ed in ErsatzTV.csproj and
burned down rule-by-rule in #25. The same rules run at suggestion on .cs.

Formatting normalization (mixed UTF-8 BOM + whitespace) is deferred to its own PR.

Full-solution Release build green (0 errors, 0 warnings).

Refs #15

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
timothy merged commit f2d0a36ed6 into main 2026-06-27 09:37:15 +02:00
timothy deleted branch foundations/15-lint-stack 2026-06-27 09:37:16 +02:00
Sign in to join this conversation.