Skip to content

Commit 55cdd42

Browse files
committed
Merge pull request #1467 from sharwell/sa1017-fixall
Update SA1017 to use OpenCloseSpacingCodeFixProvider
2 parents c77b073 + dce6342 commit 55cdd42

7 files changed

Lines changed: 4 additions & 99 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/SA1017UnitTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class ClassName2
100100
{
101101
}
102102
103-
[System.Obsolete/*comment*/]
103+
[System.Obsolete /*comment*/]
104104
class ClassNam3
105105
{
106106
}
@@ -170,7 +170,7 @@ protected override IEnumerable<DiagnosticAnalyzer> GetCSharpDiagnosticAnalyzers(
170170
/// <inheritdoc/>
171171
protected override CodeFixProvider GetCSharpCodeFixProvider()
172172
{
173-
return new SA1017CodeFixProvider();
173+
return new OpenCloseSpacingCodeFixProvider();
174174
}
175175
}
176176
}

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/OpenCloseSpacingCodeFixProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class OpenCloseSpacingCodeFixProvider : CodeFixProvider
5050
SA1014OpeningGenericBracketsMustBeSpacedCorrectly.DiagnosticId,
5151
SA1015ClosingGenericBracketsMustBeSpacedCorrectly.DiagnosticId,
5252
SA1016OpeningAttributeBracketsMustBeSpacedCorrectly.DiagnosticId,
53+
SA1017ClosingAttributeBracketsMustBeSpacedCorrectly.DiagnosticId,
5354
SA1019MemberAccessSymbolsMustBeSpacedCorrectly.DiagnosticId,
5455
SA1020IncrementDecrementSymbolsMustBeSpacedCorrectly.DiagnosticId,
5556
SA1021NegativeSignsMustBeSpacedCorrectly.DiagnosticId,

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1017ClosingAttributeBracketsMustBeSpacedCorrectly.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private static void HandleCloseBracketToken(SyntaxTreeAnalysisContext context, S
103103
}
104104

105105
// Closing attribute brackets must not be preceded by a space.
106-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation()));
106+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), OpenCloseSpacingCodeFixProvider.RemoveImmediatePreceding));
107107
}
108108
}
109109
}

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1017CodeFixProvider.cs

Lines changed: 0 additions & 83 deletions
This file was deleted.

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SpacingResources.Designer.cs

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SpacingResources.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,6 @@
177177
<data name="SA1016Title" xml:space="preserve">
178178
<value>Opening attribute brackets must be spaced correctly</value>
179179
</data>
180-
<data name="SA1017CodeFix" xml:space="preserve">
181-
<value>Fix spacing</value>
182-
</data>
183180
<data name="SA1017Description" xml:space="preserve">
184181
<value>A closing attribute bracket within a C# element is not spaced correctly.</value>
185182
</data>

StyleCop.Analyzers/StyleCop.Analyzers/StyleCop.Analyzers.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@
353353
<Compile Include="SpacingRules\SA1015ClosingGenericBracketsMustBeSpacedCorrectly.cs" />
354354
<Compile Include="SpacingRules\SA1016OpeningAttributeBracketsMustBeSpacedCorrectly.cs" />
355355
<Compile Include="SpacingRules\SA1017ClosingAttributeBracketsMustBeSpacedCorrectly.cs" />
356-
<Compile Include="SpacingRules\SA1017CodeFixProvider.cs" />
357356
<Compile Include="SpacingRules\SA1018CodeFixProvider.cs" />
358357
<Compile Include="SpacingRules\SA1018NullableTypeSymbolsMustNotBePrecededBySpace.cs" />
359358
<Compile Include="SpacingRules\SA1019MemberAccessSymbolsMustBeSpacedCorrectly.cs" />

0 commit comments

Comments
 (0)