Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 1.49 KB

File metadata and controls

47 lines (35 loc) · 1.49 KB

SA1015

TypeName SA1015ClosingGenericBracketsMustBeSpacedCorrectly
CheckId SA1015
Category Spacing Rules

Cause

A closing generic bracket within a C# element is not spaced correctly.

Rule description

A violation of this rule occurs when the spacing around a closing generic bracket is not correct.

A closing generic bracket should never be preceded by whitespace, unless the bracket is the first character on the line. A closing generic bracket should be followed by an open parenthesis, a close parenthesis, a closing generic bracket, a nullable symbol, an end of line or a single whitespace (but not whitespace and an open parenthesis). In nullable-aware contexts, nullable reference type annotations (for example List<string?>?) follow the same rules as nullable value types.

The > token that ends a C# 9 function pointer parameter list follows the same spacing rules, for example delegate*<int, void>.

How to fix violations

To fix a violation of this rule, ensure the whitespace around the closing generic bracket is correct.

How to suppress violations

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