S3L0004: No inline comments¶
No comment lives inside a member body; a name says it instead.
| Category | Snail |
| Severity | warning — an error under TreatWarningsAsErrors, which every Snail project builds with |
| Analyzer | SourceText in Snail.Sdk.Analyzers |
| Code fix | none — the fix is a name |
What it reports¶
A // or /* */ comment inside a member body: a method, an accessor, a local function, a lambda block or an
expression body.
What it leaves alone¶
XML documentation comments (///) and comments between members — on a type, a member, a field.
Why¶
The guidelines forbid comments inside members. A block that needs a comment to be understood is a method waiting for its name; a comment drifts from the code, a name is checked by the compiler at every call.
How to fix¶
Extract the block into a private method named for what the comment said, or rename a variable so it says it, then delete the comment. What a member does and why belongs in its XML documentation.
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", "S3L0004:No inline comments", 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).