fix(analyzers): unblock main — S3241 fires on three unused-return extension methods#64
Conversation
…isfy S3241 Main has been broken since #63 (analyzers bump) landed — SonarAnalyzer's S3241 rule now fires on three pre-existing private extension methods in NextAurora.ServiceDefaults/Extensions.cs that return TBuilder but whose callers ignore the return value: - AddOpenTelemetryExporters<TBuilder> (line 107) - AddDefaultAuthentication<TBuilder> (line 169) - AddNextAuroraApiVersioning<TBuilder> (line 234) S3241: "Change return type to 'void'; not a single caller uses the returned value." Every Dependabot rebase since #63 has been failing CI with the same three errors, blocking #35, #36, #61 from merging. Unblocks the queue. The rule is correct — all three were called as statements (`builder.AddOpenTelemetryExporters();`) with the return discarded. Changes the return type to `void`, drops the `return builder;` lines (and converts the early-return in AddDefaultAuthentication from `return builder;` to bare `return;`). No behavior change. No caller change. Build green locally. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThree private extension helper methods in ChangesExtension Method Return-Type Refactoring
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Main has been broken since #63 (analyzers bump) landed. SonarAnalyzer's tightened S3241 rule now fires on three pre-existing private extension methods in `NextAurora.ServiceDefaults/Extensions.cs`:
```
error S3241: Change return type to 'void'; not a single caller uses the returned value.
Extensions.cs:107 AddOpenTelemetryExporters
Extensions.cs:169 AddDefaultAuthentication
Extensions.cs:234 AddNextAuroraApiVersioning
```
Every Dependabot rebase since #63 has been failing CI with these three errors, blocking #35, #36, #61 from merging.
The fix
Three private `TBuilder`-returning helpers had every caller invoke them as statements (`builder.AddOpenTelemetryExporters();`) with the return discarded. The rule is correctly identifying dead returns. Changes return type to `void`, drops the `return builder;` statements, and converts the early-return in `AddDefaultAuthentication` from `return builder;` to bare `return;`.
Three methods, +4/-10 lines. No behavior change, no caller change.
Verification
Unblocks
After this lands:
```bash
for pr in 35 36 61; do gh pr comment $pr --body "@dependabot rebase"; done
```
The Dependabot bumps + the doc-PR queue should all go green on rebase.
Pattern note
This is the kind of analyzer-bump regression that's worth catching at the PR-review stage. A path-instruction in `.coderabbit.yaml` for `NextAurora.ServiceDefaults/Extensions.cs` or `**/*Extensions.cs` files could remind reviewers to check that extension-method return values are actually consumed. Not blocking — main is the priority right now — but worth a small encoding pass later.
🤖 Generated with Claude Code
Summary by CodeRabbit