Skip to content

chore: clear redundant/dead-code InspectCode findings (tests + contract bases) - #393

Merged
Chris-Wolfgang merged 1 commit into
vNextfrom
fix/inspectcode-redundancies-0.23
Aug 16, 2026
Merged

Chris-Wolfgang merged 1 commit into
vNextfrom
fix/inspectcode-redundancies-0.23

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Clears the InspectCode code-scanning findings the post-0.23.0 main scan surfaced (67 total): fixes the genuinely-redundant/dead ones, dismisses the rest as false-positives or intentional test patterns. Fix-first per the agreed approach.

Fixed (~43, this PR)

  • RedundantCast ×30 — removed (IProgress<TProgress>) / (IAsyncEnumerable<TItem>) casts on null! null-guard args, plus lambda/ctor casts. Each verified not to change overload resolution (the only alternative overloads add a non-nullable CancellationToken, which null can't bind).
  • RedundantTypeArgumentsOfMethod, RedundantNameQualifier, RedundantWithCancellation, RedundantArgumentDefaultValue, RedundantAssignment — removed.
  • UnusedVariable / NotAccessedVariable — discarded unused await foreach vars; removed a write-only capturedTimer (kept the Elapsed subscription).
  • S4456 — split the two-arg ExtractAsync(progress, token) test double into an eager-validating wrapper + iterator core (matches RetryingExtractor).

Dismissed on the dashboard (24 — code is correct)

  • ! after Assert.NotNull ×8 — required on net462/netstandard2.0 (xUnit 2.9 lacks [NotNull]); redundant only on net8.0+.
  • using ×5 in AllocationRegressionTests — whole file is inside #if NET6_0_OR_GREATER; needed by the net6+ body.
  • S6966 ×2 — wants CancelAsync, which is net8+ only; library targets down to net462.
  • MA0055 ×3 — FinalizationSuppressionTests finalizers are the subject under test.
  • S3877 ×2 — ThrowingDisposable* doubles throw from Dispose on purpose.
  • S3871 ×1 — internal test-double sentinel exception, never crosses an assembly boundary.
  • GenericEnumeratorNotDisposed ×2 + its RedundantCast ×1 — casts assert both interface GetEnumerators return self.

Verification

  • Full-matrix Release build (net462…net10, warnings-as-errors): green.
  • 1072 net8.0 tests pass (contract tests assert which overload is called, so a silent binding change would fail them).

🤖 Generated with Claude Code

…ract bases

Fixes the ~43 genuinely-redundant InspectCode findings the post-0.23.0 main
scan surfaced (mostly in test projects and the shipped TestKit.Xunit
contract-base helpers):

- RedundantCast x30: dropped `(IProgress<TProgress>)`/`(IAsyncEnumerable<TItem>)`
  casts on `null!` null-guard arguments and lambda/ctor casts. Each verified to
  not change overload resolution (the only alternative overloads add a
  non-nullable CancellationToken, which `null` can't bind).
- RedundantTypeArgumentsOfMethod, RedundantNameQualifier, RedundantWithCancellation,
  RedundantArgumentDefaultValue, RedundantAssignment: removed.
- UnusedVariable/NotAccessedVariable: discarded unused `await foreach` vars and
  removed a write-only `capturedTimer`, preserving load-bearing side effects.
- S4456: split the two-arg `ExtractAsync(progress, token)` test double into an
  eager-validating wrapper + iterator core, matching RetryingExtractor.

The remaining findings are dismissed as false-positives or intentional test
patterns (the `!` after Assert.NotNull needed on net462/netstandard2.0; usings
inside an #if NET6_0_OR_GREATER file; finalizers that are the subject of
FinalizationSuppressionTests; ThrowingDisposable doubles; CancelAsync which is
net8+ only).

Full-matrix Release build (net462..net10, warnings-as-errors) green; 1072 net8.0
tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 15, 2026 21:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BenchmarkDotNet

Details
Benchmark suite Current: 9b90d6c Previous: 23c2c32 Ratio
Wolfgang.Etl.Abstractions.Benchmarks.ExtractorBenchmarks.Extract_NoProgress(RecordCount: 1000) 31519.81462605794 ns (± 80.06415714897399) 31800.580780029297 ns (± 307.54830997169506) 0.99
Wolfgang.Etl.Abstractions.Benchmarks.ExtractorBenchmarks.Extract_WithProgress(RecordCount: 1000) 36102.14316813151 ns (± 867.8521154989195) 36281.488749186195 ns (± 253.8979487087474) 1.00
Wolfgang.Etl.Abstractions.Benchmarks.ExtractorBenchmarks.Extract_NoProgress(RecordCount: 100000) 3185449.9921875 ns (± 5422.848856623841) 3127990.4661458335 ns (± 11429.375798740686) 1.02
Wolfgang.Etl.Abstractions.Benchmarks.ExtractorBenchmarks.Extract_WithProgress(RecordCount: 100000) 3463994.1575520835 ns (± 10025.001237995582) 3916759.8196614585 ns (± 15055.495493975353) 0.88
Wolfgang.Etl.Abstractions.Benchmarks.PipelineBenchmarks.FluentPipeline(RecordCount: 1000) 29236.966379801434 ns (± 95.99428971692627) 29872.644785563152 ns (± 118.63128704029951) 0.98
Wolfgang.Etl.Abstractions.Benchmarks.PipelineBenchmarks.ManualComposition(RecordCount: 1000) 29092.47624206543 ns (± 114.36402145114212) 28800.820571899414 ns (± 74.11664119421287) 1.01
Wolfgang.Etl.Abstractions.Benchmarks.PipelineBenchmarks.BaseClassComposition(RecordCount: 1000) 80485.62573242188 ns (± 167.063866298016) 82518.81917317708 ns (± 99.99541646215732) 0.98
Wolfgang.Etl.Abstractions.Benchmarks.PipelineBenchmarks.FluentPipeline(RecordCount: 100000) 2838808.2760416665 ns (± 2016.475834747182) 2845985.0143229165 ns (± 2552.770328339048) 1.00
Wolfgang.Etl.Abstractions.Benchmarks.PipelineBenchmarks.ManualComposition(RecordCount: 100000) 2894192.2200520835 ns (± 12242.488437136786) 2865319.8111979165 ns (± 20383.721023751135) 1.01
Wolfgang.Etl.Abstractions.Benchmarks.PipelineBenchmarks.BaseClassComposition(RecordCount: 100000) 8092019.723958333 ns (± 3345.6680772877276) 8191735.723958333 ns (± 1123.8189825546328) 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@Chris-Wolfgang
Chris-Wolfgang merged commit 3167846 into vNext Aug 16, 2026
17 checks passed
@Chris-Wolfgang
Chris-Wolfgang deleted the fix/inspectcode-redundancies-0.23 branch August 16, 2026 22:02
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.

2 participants