-
-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Description
File: TUnit.Analyzers/TimeoutCancellationTokenAnalyzer.cs (Lines 43-63)
The analyzer only checks if the last parameter is a CancellationToken. It doesn't validate:
- That
CancellationTokenis the only parameter after the context parameter - That if there's a
TestContextparameter,CancellationTokencomes after it - Methods with multiple parameters where
CancellationTokenisn't last
Impact
False negatives — methods with wrong parameter order (e.g., Method(CancellationToken ct, TestContext ctx)) won't be detected.
Suggested Fix
Validate parameter order more thoroughly:
Valid: (TimeoutContext ctx, CancellationToken ct)
Valid: (CancellationToken ct)
Invalid: (TestContext ctx) - missing CancellationToken
Invalid: (CancellationToken ct, TestContext ctx) - wrong order
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers