Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.19 KB

SA1012.md

File metadata and controls

43 lines (31 loc) · 1.19 KB

SA1012

TypeName SA1012OpeningBracesMustBeSpacedCorrectly
CheckId SA1012
Category Spacing Rules

Cause

An opening brace within a C# element is not spaced correctly.

Rule description

A violation of this rule occurs when the spacing around an opening brace is not correct.

An opening brace should always be preceded by a single space, unless it is the first character on the line, or unless it is preceded by an opening parenthesis, in which case there should be no space between the parenthesis and the brace.

An opening brace should always be followed by a single space, unless it is the last character on the line.

How to fix violations

To fix a violation of this rule, ensure that the spacing around the opening brace follows the rule described above.

How to suppress violations

[SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1012:OpeningBracesMustBeSpacedCorrectly", Justification = "Reviewed.")]
#pragma warning disable SA1012 // OpeningBracesMustBeSpacedCorrectly
#pragma warning restore SA1012 // OpeningBracesMustBeSpacedCorrectly