-
Notifications
You must be signed in to change notification settings - Fork 22
SA1108
TypeName |
BlockStatementsMustNotContainEmbeddedComments |
CheckId |
SA1108 |
Category |
Readability Rules |
A C# statement contains a comment between the declaration of the statement and the opening curly bracket of the statement.
A violation of this rule occurs when the code contains a comment in between the declaration and the opening curly bracket. For example:
if (x != y)
// Make sure x does not equal y
{
}
The comment can legally be placed above the statement, or within the body of the statement:
// Make sure x does not equal y
if (x != y)
{
}
if (x != y)
{
// Make sure x does not equal y
}
If the comment is being used to comment out a line of code, begin the comment with four forward slashes rather than two:
if (x != y)
////if (x == y)
{
}
To fix a violation of this rule, move the comment above the statement, within the body of the statement, or remove the comment.
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1108:BlockStatementsMustNotContainEmbeddedComments", 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