Skip to content

Commit 578fd98

Browse files
author
Kapil Borle
committed
Use same correction method for operator/separator violation
1 parent 81a241f commit 578fd98

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

Rules/UseWhitespace.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,27 +183,10 @@ private IEnumerable<DiagnosticRecord> FindSeparatorViolations(TokenOperations to
183183
yield return getDiagnosticRecord(
184184
tokenNode.Value,
185185
errorKind,
186-
GetSeparatorCorrections(errorKind, tokenNode.Value, tokenNode.Next.Value).ToList());
186+
GetOperatorCorrections(tokenNode.Previous.Value, tokenNode.Value, tokenNode.Next.Value, true, false).ToList());
187187
}
188188
}
189189

190-
private IEnumerable<CorrectionExtent> GetSeparatorCorrections(
191-
ErrorKind errorKind,
192-
Token separatorToken,
193-
Token nextToken)
194-
{
195-
var e1 = separatorToken.Extent;
196-
var e2 = nextToken.Extent;
197-
var extent = new ScriptExtent(
198-
new ScriptPosition(e1.File, e1.StartLineNumber, e1.StartColumnNumber, null),
199-
new ScriptPosition(e2.File, e2.StartLineNumber, e2.StartColumnNumber, null));
200-
yield return new CorrectionExtent(
201-
separatorToken.Extent,
202-
separatorToken.Text + whiteSpace,
203-
separatorToken.Extent.File,
204-
GetError(errorKind)); // TODO replace with better string
205-
}
206-
207190
private DiagnosticRecord getDiagnosticRecord(
208191
Token token,
209192
ErrorKind errKind,

0 commit comments

Comments
 (0)