Skip to content

doc-typeparam-has-text

C#styleno fixdefault: offcsharp/stylecop

Reports a <typeparam> without text (<typeparam name="T" /> counts as without text), in the documentation of a generic class, struct, interface, method or delegate. No fix.

A type parameter with an empty description looks documented and says nothing about what T is for, and it stops tools from reporting the missing text.

To fix, describe the type parameter.

Reported
...
/// <typeparam name="T"></typeparam>
/// <typeparam name="U" />
/// <typeparam name="V">Good.</typeparam>
public class Generic<T, U, V>
{
/// <summary>Method.</summary>
/// <typeparam name="X"></typeparam>
...
public void Method<X>() { }
...
}
/// <summary>Struct.</summary>
/// <typeparam name="T"></typeparam>
public struct GenericStruct<T> { }
/// <summary>Interface.</summary>
...
public interface IGeneric<T> { }
/// <summary>Delegate.</summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="U" />
public delegate void GenericCallback<T, U>();
/// <summary>Partial.</summary>
...
csharp:
lint:
rules:
doc-typeparam-has-text: warn # off (default), warn, error

Enabled by the presets: csharp/stylecop.

Suppress one line with sudsy-disable-next-line doc-typeparam-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 SA1622 full