-
Notifications
You must be signed in to change notification settings - Fork 22
SA1003
TypeName |
SymbolsMustBeSpacedCorrectly |
CheckId |
SA1003 |
Category |
Spacing Rules |
The spacing around an operator symbol is incorrect, within a C# code file.
A violation of this rule occurs when the spacing around an operator symbol is incorrect.
The following types of operator symbols must be surrounded by a single space on either side: colons, arithmetic operators, assignment operators, conditional operators, logical operators, relational operators, shift operators, and lambda operators. For example:
int x = 4 + y;
In contrast, unary operators must be preceded by a single space, but must never befollowed by any space. For example:
bool x = !value;
An exception occurs whenever the symbol is preceded or followed by a parenthesis or bracket, in which case there should be no space between the symbol and the bracket. For example:
if (!value)
{
}
To fix a violation of this rule, ensure that the spacing around the symbol follows the rule described above.
[SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1003:SymbolsMustBeSpacedCorrectly", 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