Skip to content

doc-comment-space

C#stylefix: safedefault: offcsharp/stylecop

Reports a documentation line (///) that does not start with a single space. More spaces are allowed to indent continuation lines, but not on the first line of the comment; a tab or no space is always reported. The fix writes the single space.

The space after the slashes separates the marker from the text, so the text of a comment reads the same as a line of prose. A comment that starts at the slashes (///<summary>) is hard to read and differs from the rest of the file.

Reported
...
//
int a; //tail
/// <summary>x</summary>
///<summary>y</summary>
/// <summary>z</summary>
/* */
int b;
...
After the fix
...
//
int a; //tail
/// <summary>x</summary>
/// <summary>y</summary>
/// <summary>z</summary>
/* */
int b;
...
csharp:
lint:
rules:
doc-comment-space: warn # off (default), warn, error

Enabled by the presets: csharp/stylecop.

Suppress one line with sudsy-disable-next-line doc-comment-space in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
StyleCop SA1004 full