Skip to content

Commit 16371e2

Browse files
committed
Remove cases where analyzers referenced members of code fix providers
Fixes #1658
1 parent 219bf01 commit 16371e2

29 files changed

Lines changed: 124 additions & 109 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1110OpeningParenthesisMustBeOnDeclarationLine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ private static void CheckIfLocationOfPreviousTokenAndOpenTokenAreTheSame(SyntaxN
315315
openParenLine.IsValid &&
316316
openParenLine.StartLinePosition.Line != prevTokenLine.StartLinePosition.Line)
317317
{
318-
var properties = preserveLayout ? TokenSpacingCodeFixProvider.RemovePrecedingPreserveLayout : TokenSpacingCodeFixProvider.RemovePreceding;
318+
var properties = preserveLayout ? TokenSpacingProperties.RemovePrecedingPreserveLayout : TokenSpacingProperties.RemovePreceding;
319319
context.ReportDiagnostic(Diagnostic.Create(Descriptor, openToken.GetLocation(), properties));
320320
}
321321
}

StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1111ClosingParenthesisMustBeOnLineOfLastParameter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ private static void CheckIfLocationOfLastArgumentOrParameterAndCloseTokenAreTheS
339339
closeParenLine.IsValid &&
340340
closeParenLine.StartLinePosition.Line != lastParameterLine.EndLinePosition.Line)
341341
{
342-
var properties = TokenSpacingCodeFixProvider.RemovePreceding;
342+
var properties = TokenSpacingProperties.RemovePreceding;
343343
context.ReportDiagnostic(Diagnostic.Create(Descriptor, closeToken.GetLocation(), properties));
344344
}
345345
}

StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1112ClosingParenthesisMustBeOnLineOfOpeningParenthesis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private static void CheckIfLocationOfOpenAndCloseTokensAreTheSame(
141141
openParenLine.IsValid &&
142142
openParenLine.StartLinePosition.Line != closeParenLine.StartLinePosition.Line)
143143
{
144-
var properties = TokenSpacingCodeFixProvider.RemovePreceding;
144+
var properties = TokenSpacingProperties.RemovePreceding;
145145
context.ReportDiagnostic(Diagnostic.Create(Descriptor, closeToken.GetLocation(), properties));
146146
}
147147
}

StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1113CommaMustBeOnSameLineAsPreviousParameter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ private static void CheckIfCommasAreAtTheSameLineAsThePreviousParameter(SyntaxNo
242242

243243
if (previousNode.GetEndLine() < nodeOrToken.GetLineSpan().StartLinePosition.Line)
244244
{
245-
var properties = TokenSpacingCodeFixProvider.RemovePrecedingPreserveLayout;
245+
var properties = TokenSpacingProperties.RemovePrecedingPreserveLayout;
246246
context.ReportDiagnostic(Diagnostic.Create(Descriptor, nodeOrToken.GetLocation(), properties));
247247
}
248248
}

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1000KeywordsMustBeSpacedCorrectly.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private static void HandleRequiredSpaceToken(SyntaxTreeAnalysisContext context,
179179
}
180180
}
181181

182-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingCodeFixProvider.InsertFollowing, token.Text, string.Empty));
182+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingProperties.InsertFollowing, token.Text, string.Empty));
183183
}
184184

185185
private static void HandleDisallowedSpaceToken(SyntaxTreeAnalysisContext context, SyntaxToken token)
@@ -194,7 +194,7 @@ private static void HandleDisallowedSpaceToken(SyntaxTreeAnalysisContext context
194194
return;
195195
}
196196

197-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingCodeFixProvider.RemoveFollowing, token.Text, " not"));
197+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingProperties.RemoveFollowing, token.Text, " not"));
198198
}
199199

200200
private static void HandleDisallowedSpaceToken(SyntaxNodeAnalysisContext context, SyntaxToken token)
@@ -209,7 +209,7 @@ private static void HandleDisallowedSpaceToken(SyntaxNodeAnalysisContext context
209209
return;
210210
}
211211

212-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingCodeFixProvider.RemoveFollowing, token.Text, " not"));
212+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingProperties.RemoveFollowing, token.Text, " not"));
213213
}
214214

215215
private static void HandleNewKeywordToken(SyntaxTreeAnalysisContext context, SyntaxToken token)

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1001CommasMustBeSpacedCorrectly.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ private static void HandleCommaToken(SyntaxTreeAnalysisContext context, SyntaxTo
104104
if (hasPrecedingSpace)
105105
{
106106
// comma must{ not} be {preceded} by a space
107-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingCodeFixProvider.RemovePreceding, " not", "preceded"));
107+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingProperties.RemovePreceding, " not", "preceded"));
108108
}
109109

110110
if (missingFollowingSpace)
111111
{
112112
// comma must{} be {followed} by a space
113-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingCodeFixProvider.InsertFollowing, string.Empty, "followed"));
113+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingProperties.InsertFollowing, string.Empty, "followed"));
114114
}
115115
}
116116
}

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1002SemicolonsMustBeSpacedCorrectly.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ private static void HandleSemicolonToken(SyntaxTreeAnalysisContext context, Synt
119119
if (missingFollowingSpace)
120120
{
121121
// semicolon must{} be {followed} by a space
122-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingCodeFixProvider.InsertFollowing, string.Empty, "followed"));
122+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingProperties.InsertFollowing, string.Empty, "followed"));
123123
}
124124

125125
if (hasPrecedingSpace && !ignorePrecedingSpace)
126126
{
127127
// semicolon must{ not} be {preceded} by a space
128-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingCodeFixProvider.RemoveImmediatePreceding, " not", "preceded"));
128+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingProperties.RemoveImmediatePreceding, " not", "preceded"));
129129
}
130130
}
131131
}

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1006PreprocessorKeywordsMustNotBePrecededBySpace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private static void HandleHashToken(SyntaxTreeAnalysisContext context, SyntaxTok
9292
}
9393

9494
// Preprocessor keyword '{keyword}' must not be preceded by a space.
95-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, targetToken.GetLocation(), TokenSpacingCodeFixProvider.RemovePreceding, targetToken.Text));
95+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, targetToken.GetLocation(), TokenSpacingProperties.RemovePreceding, targetToken.Text));
9696
}
9797
}
9898
}

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1007OperatorKeywordMustBeFollowedBySpace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private static void HandleRequiredSpaceToken(SyntaxTreeAnalysisContext context,
8989
}
9090
}
9191

92-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingCodeFixProvider.InsertFollowing));
92+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation(), TokenSpacingProperties.InsertFollowing));
9393
}
9494
}
9595
}

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1008OpeningParenthesisMustBeSpacedCorrectly.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,18 @@ private static void HandleOpenParenToken(SyntaxTreeAnalysisContext context, Synt
196196
{
197197
if (haveLeadingSpace)
198198
{
199-
context.ReportDiagnostic(Diagnostic.Create(DescriptorPreceded, token.GetLocation(), TokenSpacingCodeFixProvider.InsertPreceding));
199+
context.ReportDiagnostic(Diagnostic.Create(DescriptorPreceded, token.GetLocation(), TokenSpacingProperties.InsertPreceding));
200200
}
201201
else
202202
{
203-
context.ReportDiagnostic(Diagnostic.Create(DescriptorNotPreceded, token.GetLocation(), TokenSpacingCodeFixProvider.RemovePreceding));
203+
context.ReportDiagnostic(Diagnostic.Create(DescriptorNotPreceded, token.GetLocation(), TokenSpacingProperties.RemovePreceding));
204204
}
205205
}
206206
}
207207

208208
if (token.IsFollowedByWhitespace())
209209
{
210-
context.ReportDiagnostic(Diagnostic.Create(DescriptorNotFollowed, token.GetLocation(), TokenSpacingCodeFixProvider.RemoveFollowing));
210+
context.ReportDiagnostic(Diagnostic.Create(DescriptorNotFollowed, token.GetLocation(), TokenSpacingProperties.RemoveFollowing));
211211
}
212212
}
213213
}

0 commit comments

Comments
 (0)