Skip to content

chore: arm the warnings-as-errors gate; zero-warning build - #155

Merged
github-actions[bot] merged 1 commit into
mainfrom
claude/warnings-as-errors
Jul 6, 2026
Merged

chore: arm the warnings-as-errors gate; zero-warning build#155
github-actions[bot] merged 1 commit into
mainfrom
claude/warnings-as-errors

Conversation

@ANcpLua

@ANcpLua ANcpLua commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

The gate was toothless: TreatWarningsAsErrors keys on ContinuousIntegrationBuild, which the workflow never sets (only CI=true) — so CI has been building green with ~236 unique analyzer warnings. This PR arms the gate and clears the debt so it can stay armed.

1. Arm the gate

Directory.Build.props maps CI=trueContinuousIntegrationBuild=true. From this PR on, any new warning fails CI.

2. Fix the real ones in code

CA1305 (invariant culture in TypeCache), CA1307 (ordinal Contains/Replace), CA2007 (ConfigureAwait scope pattern for await using in Testing MSBuild helpers ×5), CA1063 (proper Dispose(bool) on SolutionRefactoringTest), CA1859 (concrete return types on 3 private helpers), CA1822 (dead Dispose removed), RS2008 (test-only descriptor pragma), CA1849 (pragma ×2 — CancelAsync doesn't exist on netstandard2.0).

Proof the gate works: arming it immediately surfaced 6 xUnit1051 violations (missing TestContext cancellation tokens) in tests added during 2.2.30–2.2.33 — as errors. All fixed.

3. Categorical rules configured off — each with a written justification in .editorconfig

CA1062 (redundant with enforced NRT on ~390 sites; Roslyn inputs non-null by contract), CA1815 (scope/builder/enumerator structs), CA1031 (deliberate exception-to-data helpers), CA1034 (zero-alloc enumerator pattern), CA1054/CA1055 (opaque OTel schema URLs), CA1028 (wire-format byte enums), CA1024 + naming rules CA1710/CA1711/CA1721 (shipped API stability), CA2225 (documented As* alternates exist), CA1819 (snapshot arrays by design). New warning IDs not on this list still fail the build.

Verification

  • CI=true clean rebuild: 0 warnings, 0 errors (was 236 unique / 467 total warnings)
  • 215 tests passed, 0 failed

Status: complete-and-verified. Touches src/**/tests/** → publishes as 2.2.34 via auto-bump.

🤖 Generated with Claude Code

…rnings

The TreatWarningsAsErrors gate keyed on ContinuousIntegrationBuild, which CI
never set (GitHub Actions only sets CI=true) — so CI built green with ~236
unique analyzer warnings. Directory.Build.props now maps CI=true to
ContinuousIntegrationBuild=true, and the warning debt is cleared:

Fixed in code:
- CA1305: TypeCache Convert.ToInt32 with invariant culture
- CA1307: ordinal Contains in Guard.Path; ordinal Replace in tests
- CA2007: ConfigureAwait(false) scope pattern for await-using in Testing MSBuild helpers
- CA1063: full Dispose(bool) pattern on SolutionRefactoringTest
- CA1859: concrete return types on three private helpers
- CA1822: removed dead Dispose on private NonGenericEnumerator
- RS2008: pragma for the test-only descriptor
- CA1849: pragma x2 (CancelAsync unavailable on netstandard2.0)
- xUnit1051 x6: TestContext cancellation tokens in recent tests (caught by
  the newly armed gate — errors, not warnings, proving the gate works)

Configured off in .editorconfig, each with a written justification: CA1062
(redundant with enforced NRT), CA1815, CA1031, CA1034, CA1054/CA1055,
CA1028, CA1024, CA1710/CA1711/CA1721, CA2225, CA1819.

CI=true clean rebuild: 0 warnings, 0 errors. 215 tests green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions
github-actions Bot merged commit 671c1bf into main Jul 6, 2026
3 of 4 checks passed
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c478944c-843a-4abc-b66a-ce5ef3fd3a23

📥 Commits

Reviewing files that changed from the base of the PR and between 6754fe0 and eddec1d.

⛔ Files ignored due to path filters (2)
  • .claude/TASK.md is excluded by none and included by none
  • .editorconfig is excluded by none and included by none
📒 Files selected for processing (15)
  • Directory.Build.props
  • src/ANcpLua.Roslyn.Utilities.Testing/MSBuild/DotNetSdkHelpers.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/MSBuild/PackageTestBase.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/SolutionRefactoringTest.cs
  • src/ANcpLua.Roslyn.Utilities/Async/ParallelAsyncExtensions.cs
  • src/ANcpLua.Roslyn.Utilities/CodeGeneration.cs
  • src/ANcpLua.Roslyn.Utilities/DocumentationExtensions.cs
  • src/ANcpLua.Roslyn.Utilities/Enumerator.cs
  • src/ANcpLua.Roslyn.Utilities/Guard.Path.cs
  • src/ANcpLua.Roslyn.Utilities/SyntaxExtensions.cs
  • src/ANcpLua.Roslyn.Utilities/TypeCache.cs
  • tests/ANcpLua.Roslyn.Utilities.Testing.Tests/ConvertExtensionsTests.cs
  • tests/ANcpLua.Roslyn.Utilities.Testing.Tests/IncrementalValuesProviderExtensionsTests.cs
  • tests/ANcpLua.Roslyn.Utilities.Testing.Tests/TreeBoundLocationTests.cs
  • tests/ANcpLua.Roslyn.Utilities.Testing.Tests/TypeDeclarationInfoTests.cs

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


Summary by CodeRabbit

  • Bug Fixes

    • Improved consistency in validation and parsing so behavior is less dependent on system culture or environment.
    • CI builds now more reliably apply warning-as-error settings in hosted pipelines.
    • Adjusted resource handling in a few background operations to improve stability.
  • Tests

    • Updated test coverage to use culture-invariant message checks and cancellation-aware execution for more reliable results.

Walkthrough

Changes include a CI-driven warnings-as-errors toggle in Directory.Build.props, ConfigureAwait-based async disposal scoping in MSBuild helper/test-base classes, a Dispose(bool) pattern addition in SolutionRefactoringTest, CA1849 suppressions, return-type tightening on several utility methods, ordinal-comparison and invariant-culture fixes in Guard.Path and TypeCache, and corresponding test updates for culture/cancellation-token consistency.

Changes

Build config, async disposal, and code cleanups

Layer / File(s) Summary
CI warnings-as-errors toggle
Directory.Build.props
ContinuousIntegrationBuild defaults to true when CI=true and unset, enabling existing warning-as-error gating on GitHub Actions.
Async disposal scoping and Dispose pattern fixes
src/ANcpLua.Roslyn.Utilities.Testing/MSBuild/DotNetSdkHelpers.cs, src/ANcpLua.Roslyn.Utilities.Testing/MSBuild/PackageTestBase.cs, src/ANcpLua.Roslyn.Utilities.Testing/SolutionRefactoringTest.cs
GZipStream/TarReader/output stream and project builder disposal now use .ConfigureAwait(false)-wrapped scopes; SolutionRefactoringTest adds a Dispose(bool disposing) overload replacing direct disposal in Dispose().
CA1849 suppression for cancellation calls
src/ANcpLua.Roslyn.Utilities/Async/ParallelAsyncExtensions.cs
cts.Cancel() calls in SelectParallel/SelectParallelOrdered are wrapped with CA1849 pragma suppression.
Return type tightening and empty Dispose removal
src/ANcpLua.Roslyn.Utilities/CodeGeneration.cs, src/ANcpLua.Roslyn.Utilities/DocumentationExtensions.cs, src/ANcpLua.Roslyn.Utilities/SyntaxExtensions.cs, src/ANcpLua.Roslyn.Utilities/Enumerator.cs
ValidateWarningIds, RewriteInheritdocElements, and ParseGenericArguments return concrete array/list types; empty Dispose() removed from NonGenericEnumerator.
Ordinal comparison and invariant-culture conversions
src/ANcpLua.Roslyn.Utilities/Guard.Path.cs, src/ANcpLua.Roslyn.Utilities/TypeCache.cs
Path-separator checks use explicit StringComparison.Ordinal; enum-to-int conversions use CultureInfo.InvariantCulture.
Test updates for ordinal/invariant-culture and cancellation tokens
tests/ANcpLua.Roslyn.Utilities.Testing.Tests/ConvertExtensionsTests.cs, .../IncrementalValuesProviderExtensionsTests.cs, .../TreeBoundLocationTests.cs, .../TypeDeclarationInfoTests.cs
Tests updated to use StringComparison.Ordinal, CultureInfo.InvariantCulture diagnostic messages, RS2008 suppression, and TestContext.Current.CancellationToken in syntax tree parsing, diagnostics, and generator runs.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

Suggested labels: area:infra


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

github-actions Bot pushed a commit that referenced this pull request Jul 6, 2026
….2.35 round-trip surface) (#157)

Arc A (#155 → 2.2.34): warnings-as-errors gate armed, zero-warning build.
Arc B (#156 → 2.2.35): GetFullyQualifiedMetadataName + GetFullyQualifiedName.
Both indexed on nuget.org; qyl bumped 2.2.33 → 2.2.35 in qyl#494.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant