-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add rule checking for trailing whitespace #215
Conversation
This rule is based on the no_tabs rule, but checks for trailing whitespace instead. The 'info' field of the elvis items returned contain the position, length, and the contents of the matched trailing whitespace. It could be useful for debugging.
This rule is almost exactly what issue #147 is all about. Can you add the ignore whitespaces on empty lines option to the rule to make it 100% compliant with the requirements from that issue? |
Absolutely. However, I do not fully understand the need for ignoring whitespace on empty lines. Trailing whitespace is just as unnecessary/annoying on empty lines as they are on non-emtpy lines. The option is easy to add, but is it useful? |
@dvaergiller I'm with you on that, but… the truth is that many text editors that have a "remove trailing whitespace" setting, also have an "except in case of full whitespace lines". That's why @HernanRivasAcosta pointed out the necessity of such an option in our rule. |
The default for that option should be |
That sounds reasonable. As long as someone considers it useful, it's useful. |
I do get 7 failing test cases when I run make quicktests, but they all seem unrelated to these commits. Tell me if I am wrong. |
Add rule checking for trailing whitespace
Thanks, @dvaergiller . |
If the ignore_empty_lines option is set to true in configuration, the rule will not complain about lines consisting of only whitespace characters. This can be useful in some editors that tend to ignore such whitespace. The default behaviour is to NOT ignore empty lines.
The first link gave me 404. The second one is updated. Update: I found the page that you probably meant to refer to. Updated. |
@dvaergiller Thanks for this PR 😄. I'm getting no failed test cases when running |
@jfacorro I do not know what happened with my repo, but I ran the tests again and all tests passed. So false alarm. |
This rule is based on the no_tabs rule, but checks for trailing
whitespace instead. The 'info' field of the elvis items returned contain
the position, length, and the contents of the matched trailing
whitespace. It could be useful for debugging.