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

Add rule checking for trailing whitespace #215

Merged
merged 2 commits into from
Apr 7, 2015

Conversation

dvaergiller
Copy link

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 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.
@elbrujohalcon
Copy link
Member

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?

@dvaergiller
Copy link
Author

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?

@elbrujohalcon
Copy link
Member

@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.

@elbrujohalcon
Copy link
Member

The default for that option should be false (i.e. it should consider full-whitespace lines as wrong)

@dvaergiller
Copy link
Author

That sounds reasonable. As long as someone considers it useful, it's useful.

@dvaergiller
Copy link
Author

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.

elbrujohalcon pushed a commit that referenced this pull request Apr 7, 2015
Add rule checking for trailing whitespace
@elbrujohalcon elbrujohalcon merged commit 5ad8afd into inaka:master Apr 7, 2015
@elbrujohalcon
Copy link
Member

Thanks, @dvaergiller .
Would you be so kind to update the wiki here and here?

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.
@dvaergiller
Copy link
Author

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 dvaergiller deleted the trailing_whitespace branch April 7, 2015 16:52
@jfacorro
Copy link
Contributor

jfacorro commented Apr 8, 2015

@dvaergiller Thanks for this PR 😄. I'm getting no failed test cases when running make quicktests or make tests on master. Do you still get those failed tests? If so, could you share which are failing?

@dvaergiller
Copy link
Author

@jfacorro I do not know what happened with my repo, but I ran the tests again and all tests passed. So false alarm.

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

Successfully merging this pull request may close these issues.

3 participants