Skip to content

fix(analyzers): unblock main — S3241 fires on three unused-return extension methods#64

Merged
emeraldleaf merged 1 commit into
mainfrom
fix/s3241-return-void-extensions
Jun 2, 2026
Merged

fix(analyzers): unblock main — S3241 fires on three unused-return extension methods#64
emeraldleaf merged 1 commit into
mainfrom
fix/s3241-return-void-extensions

Conversation

@emeraldleaf
Copy link
Copy Markdown
Owner

@emeraldleaf emeraldleaf commented Jun 2, 2026

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

  • `dotnet build NextAurora.ServiceDefaults/...` → 0 warnings, 0 errors
  • Full solution build → 0 errors, 1 pre-existing CS0436 warning in benchmarks (unrelated to this change)

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

  • Refactor
    • Internal code optimization with no user-visible impact.

…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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8a286aa4-39eb-4565-a253-68a383d51611

📥 Commits

Reviewing files that changed from the base of the PR and between b8a1201 and 2cf046f.

📒 Files selected for processing (1)
  • NextAurora.ServiceDefaults/Extensions.cs

Walkthrough

Three private extension helper methods in NextAurora.ServiceDefaults/Extensions.cs are refactored to return void instead of TBuilder. Return statements are removed, and early-exit returns are simplified to bare return statements.

Changes

Extension Method Return-Type Refactoring

Layer / File(s) Summary
Private helper method return-type refactoring
NextAurora.ServiceDefaults/Extensions.cs
AddOpenTelemetryExporters, AddDefaultAuthentication, and AddNextAuroraApiVersioning change from TBuilder return type to void. All trailing return builder; statements are removed. Early-exit return builder; in AddDefaultAuthentication simplifies to bare return;. Call sites remain as standalone statements without chaining.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing a SonarAnalyzer rule S3241 violation by converting three unused-return extension methods to return void.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/s3241-return-void-extensions

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@emeraldleaf emeraldleaf merged commit 989039d into main Jun 2, 2026
5 of 6 checks passed
@emeraldleaf emeraldleaf deleted the fix/s3241-return-void-extensions branch June 2, 2026 03:26
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.

1 participant