BRO1608: Void return value should not be documented¶
A method or delegate that returns void has no <returns> documentation. Replaces StyleCop SA1617.
Example¶
Before¶
public class Logger
{
/// <summary>Writes a message.</summary>
/// <param name="message">The message.</param>
/// <returns>Nothing.</returns>
public void Write(string message)
{
}
}
After¶
public class Logger
{
/// <summary>Writes a message.</summary>
/// <param name="message">The message.</param>
public void Write(string message)
{
}
}
Why¶
There's no return value to document; the element is usually left over from a method that used to return something.
How the fix works¶
The <returns> element is removed: its whole /// lines when it has them to itself, otherwise just the element and
the spaces before it. This rule reads documentation as XML, which needs
<GenerateDocumentationFile>true</GenerateDocumentationFile>.
Compared with StyleCop¶
Same results and fixed output as StyleCop.