Migrated from DotNetAnalyzers/StyleCopAnalyzers#603:
I would like to propose the implementation and inclusion of a new StyleCop diagnostic.
Category: Documentation
Rule: Use block-level elements consistently across elements of the same kind
Description: If any sibling of the XML documentation, with the same name, uses block-level elements as children, then all siblings should use block-level elements. This generally applies to elements containing multiple paragraphs (the <para> block-level element), but can also be affected by elements like <list> and <note>. The effect of this rule is most easily seen on the following:
A sequence of <param> elements
A sequence of <exception> elements
<item> elements within a <list>
Note: This is an expansion of #20.
Rationale: This rule ensures these elements appear consistently when rendered to a variety of output media, including HTML.
Example: The most common violation of this rule in my own documentation of the past is the following:
/// <exception cref="ArgumentNullException">
/// <para>If <paramref name="x"/> is <see langword="null"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="y"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">If <paramref name="x"/> is empty.</exception>
Since the first <exception> element used block-level elements as children, the second <exception> element should have done the same:
/// <exception cref="ArgumentNullException">
/// <para>If <paramref name="x"/> is <see langword="null"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="y"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException"><para>If <paramref name="x"/> is empty.</para></exception>
Migrated from DotNetAnalyzers/StyleCopAnalyzers#603: