-
Notifications
You must be signed in to change notification settings - Fork 23
SA1514
TypeName |
ElementDocumentationHeaderMustBePrecededByBlankLine |
CheckId |
SA1514 |
Category |
Layout Rules |
An element documentation header above a C# element is not preceded by a blank line.
To improve the readability of the code, StyleCop requires blank lines in certain situations, and prohibits blank lines in other situations. This results in a consistent visual pattern across the code, which can improve recognition and readability of unfamiliar code.
A violation of this rule occurs when the element documentation header above an element is not preceded by a blank line. For example:
public bool Visible
{
get { return this.visible; }
}
/// <summary>
/// Gets a value indicating whether the control is enabled.
/// </summary>
public bool Enabled
{
get { return this.enabled; }
}
The code above would generate an instance of this violation, since the documentation header is not preceded by a blank line.
An exception to this rule occurs when the documentation header is the first item within its scope. In this case, the header should not be preceded by a blank line. For example:
public class Class1
{
/// <summary>
/// Gets a value indicating whether the control is enabled.
/// </summary>
public bool Enabled
{
get { return this.enabled; }
}
}
In the code above, the header is the first item within its scope, and thus it should not be preceded by a blank line.
To fix a violation of this rule, add a blank line above the documentation header.
[SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1514:ElementDocumentationHeaderMustBePrecededByBlankLine", Justification = "Reviewed.")]
- - SA0102 - Clean Install
- - Download
- - Documentation Rules - Layout Rules - Maintainability Rules - Naming Rules - Ordering Rules - Readability Rules - Spacing Rules - Suppressions
- - Adding a custom StyleCop settings page - Adding custom rule settings - Authoring a custom styleCop rule - Authoring rules metadata - Custom CSharp Language Service - Custom MSBuild Integration - Hosting StyleCop in a Custom Environment - Installing a Custom Rule - Integrating StyleCop Into Build Environments - Integrating StyleCop into MSBuild - Writing Custom Rules for StyleCop