Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SA1027 (TabsMustNotBeUsed) code fix ignores leading whitespace #1127

Closed
sharwell opened this issue Aug 6, 2015 · 0 comments
Closed

SA1027 (TabsMustNotBeUsed) code fix ignores leading whitespace #1127

sharwell opened this issue Aug 6, 2015 · 0 comments
Assignees
Milestone

Comments

@sharwell
Copy link
Member

sharwell commented Aug 6, 2015

Suppose you have the source code which is represented by the following C# string literal:

"public\tclass\tFoo{}"
  • If you attempt to only fix the first tab, the result is correctly indented.
  • If you attempt to fix the first tab and then the second tab, the result is correctly indented.
  • If you attempt to correct only the second tab, it is indented one space too many.

This occurs because the code fix assumes each character preceding the whitespace which is being fixed has a width of 1 character.

This problem is most likely to appear when using the fix all provider. The batch fixer applies each change in isolation and merges the result, so lines containing multiple tab characters separated by non-whitespace characters are frequently incorrect in the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant