Skip to content

doc-returns-has-text

C#styleno fixdefault: offcsharp/stylecop

Reports a <returns> without text. A comment with <inheritdoc /> is not reported. No fix.

An empty <returns></returns> looks like documentation and tells the reader nothing about the value, and it keeps tools from reporting that the result is not described.

To fix, describe what the method returns.

Reported
...
/// <summary>Returns.</summary>
/// <returns></returns>
public int EmptyReturns() => 0;
/// <summary>Returns.</summary>
/// <returns />
public int SelfClosingReturns() => 0;
/// <summary>Returns.</summary>
...
public int GoodReturns() => 0;
/// <summary>Returns.</summary>
/// <returns>
/// </returns>
public int BlankReturns() => 0;
...
public void VoidReturns() { }
/// <summary>Does.</summary>
/// <returns></returns>
public void VoidEmptyReturns() { }
/// <summary>Does.</summary>
/// <returns />
public void VoidSelfClosingReturns() { }
/// <summary>Does.</summary>
...
csharp:
lint:
rules:
doc-returns-has-text: warn # off (default), warn, error

Enabled by the presets: csharp/stylecop.

Suppress one line with sudsy-disable-next-line doc-returns-has-text 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 SA1616 full