From b281c18e5d53519d94b85caa428bd2cf63d0ee2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Hellander?= Date: Tue, 2 Jan 2024 11:35:58 +0100 Subject: [PATCH] Update SA1025 documentation to reflect handling of multiple spaces preceding a symbol #3684 --- ...SA1025CodeMustNotContainMultipleWhitespaceInARow.cs | 3 +-- documentation/KnownChanges.md | 10 ++++++++-- documentation/SA1025.md | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1025CodeMustNotContainMultipleWhitespaceInARow.cs b/StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1025CodeMustNotContainMultipleWhitespaceInARow.cs index 873947e92..0c2e4b911 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1025CodeMustNotContainMultipleWhitespaceInARow.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1025CodeMustNotContainMultipleWhitespaceInARow.cs @@ -17,8 +17,7 @@ namespace StyleCop.Analyzers.SpacingRules /// /// /// A violation of this rule occurs whenever the code contains multiple whitespace characters in a row, unless - /// the characters come at the beginning or end of a line of code, following a comma or semicolon or preceding a - /// symbol. + /// the characters come at the beginning or end of a line of code, or following a comma or semicolon. /// [DiagnosticAnalyzer(LanguageNames.CSharp)] internal class SA1025CodeMustNotContainMultipleWhitespaceInARow : DiagnosticAnalyzer diff --git a/documentation/KnownChanges.md b/documentation/KnownChanges.md index 7a6462188..3a04bc7a9 100644 --- a/documentation/KnownChanges.md +++ b/documentation/KnownChanges.md @@ -123,8 +123,14 @@ StyleCop Classic allowed multiple spaces to precede a comment placed at the end int x; // comment ``` -StyleCop Analyzers does not currently make an exception to the SA1025 rule for this case, although this decision is -still under review. +It also allowed multiple spaces preceding a symbol, such as in the second line of the following code: + +```csharp +int xyz = 1; +int w = 1; +``` + +StyleCop Analyzers does not currently make an exception to the SA1025 rule for these cases. ## Readability Rules diff --git a/documentation/SA1025.md b/documentation/SA1025.md index dddb8bc7c..52cae26d2 100644 --- a/documentation/SA1025.md +++ b/documentation/SA1025.md @@ -22,7 +22,7 @@ The code contains multiple whitespace characters in a row. ## Rule description A violation of this rule occurs whenever the code contains multiple whitespace characters in a row, unless the -characters come at the beginning or end of a line of code, following a comma or semicolon or preceding a symbol. +characters come at the beginning or end of a line of code, or following a comma or semicolon. ## How to fix violations