-
Notifications
You must be signed in to change notification settings - Fork 389
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
WIP Do not flag whitespace only lines (includes tabs) in AvoidTrailingWhiteSpace rule #1048
WIP Do not flag whitespace only lines (includes tabs) in AvoidTrailingWhiteSpace rule #1048
Conversation
I'm not convinced that this addresses the issue. The heuristic should be checking previous lines for indentation and then making sure that the initial whitespace matches when the line has non non-space characters. The change as provided would allow a line which contains only whitespace, which could lead to a DOS attack. Imagine a file which contains immense amounts of whitespace on "empty" lines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really not a fan of this change (see my comment below)
@JamesWTruher Neither am I (see discussion in linked issue) and for issues inside editors, I agree that the editor settings to auto-delete extraneous whitespace on save are the way to go. But I can understand that it's frustrating for people who run
|
One other note: ignoring whitespace-only lines doesn't seem to be exactly what the issue ask was -- that issue implied a desire to check that the whitespace exists to the correct indentation level. That is something that is arguably much more involved to implement; the rule would need to do a stateful, indentation-aware pass over the script. It's the kind of thing we allow people to define their own rules for. Naturally though, only a rule about whitespace could generate this much discussion. |
…nalyzer into DoNotFlagWhiteSpaceOnlyLines
PR Summary
Fixes #1033 by not flagging whitespace only lines (includes tabs) in AvoidTrailingWhiteSpace rule
PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
x
between the square brackets. Please mark anything not applicable to this PRNA
.WIP:
to the beginning of the title and remove the prefix when the PR is ready