no-doc-slashes-in-plain-comment
What it does
Section titled “What it does”Reports a /// comment that holds only text and no XML element: a plain comment written with documentation slashes. The fix writes //, unless the comment documents a declaration (it would remove documentation).
Why it matters
Section titled “Why it matters”Three slashes make the comment documentation, and the compiler and tools then read it as XML. A plain remark written that way is attached to the next declaration and shown in its hover, or reported as malformed.
To fix, write //.
Example
Section titled “Example”...public class PlainComments{ /// plain text on a field public int Field; /// first line /// second line public void Attached() { } /// <summary>Good.</summary>... void Body() { /// plain in a body int j = 0;
/// int k = 0;
... //// four slashes public int Four; int last; ///trailing}/// <summary>Text.</summary>......public class PlainComments{ /// plain text on a field public int Field; /// first line /// second line public void Attached() { } /// <summary>Good.</summary>... void Body() { // plain in a body int j = 0;
// int k = 0;
... //// four slashes public int Four; int last; //trailing}/// <summary>Text.</summary>...Configuration
Section titled “Configuration”csharp: lint: rules: no-doc-slashes-in-plain-comment: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line no-doc-slashes-in-plain-comment in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| StyleCop | SA1626 |
full |