S3L0008: Booleans ask¶
A boolean property or method reads as a yes/no question.
| Category | Snail |
| Severity | warning — an error under TreatWarningsAsErrors, which every Snail project builds with |
| Analyzer | Naming in Snail.Sdk.Analyzers |
| Code fix | none |
What it reports¶
A bool property, or a method returning bool, Task<bool> or ValueTask<bool>, whose name — without an Async
suffix — starts with neither a question word nor a verb in the third person. Question words are Is, Has, Can,
Should, Was, Will, Does, Contains, Exists, Supports, Try, Any, All and the rest of the list in
Naming.cs; a third-person verb is a first
word of 4 letters or more ending in s but not ss, us or is: Forces, Avoids, Preserves.
What it leaves alone¶
Fields, overrides, interface implementations, and members released in PublicAPI.Shipped.txt.
Why¶
A condition then reads as plain English: if (order.IsPaid), while (queue.HasItems).
How to fix¶
Ready → IsReady, Compress → ShouldCompress, Valid() → IsValid().
Suppressing it¶
Fix the code rather than silence the rule: the rule is part of the standard every Snail repository keeps. Where one place truly must differ, suppress that place and say why:
[SuppressMessage("Snail", "S3L0008:Booleans ask", Justification = "<why this place differs>")]
A NoWarn in a project or props file would hide the rule from every new line too; the
conformance check reports one as migration debt (S3LC0017).