Conversation
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. This PR makes a sensible design change to relax the TUnit0015 analyzer from an error to a warning. The change acknowledges that while cooperative cancellation is ideal, forcing a parameter on every method can be unnecessarily restrictive in scenarios where the timeout is just a safety net. The HTTP assertion additions are well-implemented:
The changes follow TUnit's philosophy of being modern and developer-friendly while encouraging best practices through warnings rather than compile errors. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. This PR makes a sensible design change to relax the TUnit0015 analyzer from an error to a warning. The change acknowledges that while cooperative cancellation is ideal, forcing a The HTTP assertion additions are well-implemented:
The changes follow TUnit's philosophy of being modern and developer-friendly while encouraging best practices through warnings rather than compile errors. |
[Timeout] CancellationToken parameter is now optional. The diagnostic is downgraded from Error to Warning so tests using [Timeout] as a safety net are no longer forced to accept an unused parameter. Closes #4767 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1ba51d5 to
5530d07
Compare
Summary
DiagnosticSeverity.ErrortoDiagnosticSeverity.Warning, making theCancellationTokenparameter on[Timeout]methods optional instead of mandatoryChanges
TUnit.Analyzers/Rules.cs: ChangedMissingTimeoutCancellationTokenAttributesseverity fromErrortoWarningTUnit.Analyzers/AnalyzerReleases.Unshipped.md: Tracked the severity change under "Removed Rules" (standard Roslyn release tracking format for severity changes)Context
In integration tests,
[Timeout]is often used as a safety net to prevent tests from hanging indefinitely. The test logic itself doesn't always pass the cancellation token to anything meaningful. Requiring the parameter as a compile error forces users to add unused parameters just to satisfy the compiler.With this change:
#pragma warning disable TUnit0015CancellationTokenCloses #4767
🤖 Generated with Claude Code