Skip to content

no-duplicate-doc-text

C#styleno fixdefault: offcsharp/stylecop

Reports two elements of one documentation comment with the same text (a <param> pasted twice, for example). Empty elements and “The parameter is not used.” are not reported. No fix.

Two parameters described in the same words is almost always a copy and paste that was not edited, so one of the descriptions is wrong.

To fix, write the right text for each element.

Reported
...
/// <summary>The value.</summary>
/// <param name="a">The value.</param>
/// <param name="b">The value.</param>
/// <param name="c">The parameter is not used.</param>
...
/// <summary>The value.</summary>
/// <remarks>The
/// value.</remarks>
...
/// <summary>Inline <see cref="Duplicates"/> text.</summary>
/// <remarks>Inline <see cref="Duplicates"/> text.</remarks>
/// <seealso cref="Duplicates"/>
/// <seealso cref="Duplicates"/>
public void Inline() { }
/// <summary>Same.</summary>
/// <summary>Same.</summary>
public void TwoSummaries() { }
...
/// <inheritdoc />
/// <inheritdoc />
public void Inherited() { }
...
csharp:
lint:
rules:
no-duplicate-doc-text: warn # off (default), warn, error

Enabled by the presets: csharp/stylecop.

Suppress one line with sudsy-disable-next-line no-duplicate-doc-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 SA1625 full