Skip to content

doc-text-not-empty

C#styleno fixdefault: offcsharp/stylecop

Reports a <remarks>, <example>, <exception> or <permission> element without text, written <remarks></remarks> or <remarks />. No fix.

An empty element is shown as a heading with nothing below it in the generated documentation, so it adds noise and hides that the text was never written.

To fix, write the text or delete the element.

Reported
...
{
/// <summary>Text.</summary>
/// <remarks></remarks>
/// <example />
/// <exception cref="System.Exception"></exception>
/// <exception cref="System.ArgumentException">Thrown.</exception>
/// <permission cref="System.Security.PermissionSet" />
/// <remarks>
/// </remarks>
...
/// <summary>
/// Text.
/// <remarks></remarks>
/// </summary>
public void Nested() { }
/// <remarks></remarks>
int Hidden;
...
public int Cref;
/// <remarks><!-- comment --></remarks>
public int Comment;
}
After the fix
...
{
/// <summary>Text.</summary>
/// <remarks></remarks>
/// <example />
/// <exception cref="System.Exception"></exception>
/// <exception cref="System.ArgumentException">Thrown.</exception>
/// <permission cref="System.Security.PermissionSet" />
/// <remarks>
/// </remarks>
...
/// <summary>
/// Text.
/// <remarks></remarks>
/// </summary>
public void Nested() { }
/// <remarks></remarks>
int Hidden;
...
public int Cref;
/// <remarks><!-- comment --></remarks>
public int Comment;
}
csharp:
lint:
rules:
doc-text-not-empty: warn # off (default), warn, error

Enabled by the presets: csharp/stylecop.

Suppress one line with sudsy-disable-next-line doc-text-not-empty 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 SA1627 full