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

Trailing whitespace #4123

Closed
vanniktech opened this issue Jun 25, 2016 · 12 comments
Closed

Trailing whitespace #4123

vanniktech opened this issue Jun 25, 2016 · 12 comments

Comments

@vanniktech
Copy link
Collaborator

Often when submitting a PR the trailing whitespace gets automatically deleted because Sublime / IntelliJ was configured that way.

What do you guys think about passively trying to remove those?

In 1.x version PR's containing removal of trailing whitespaces could be accepted rather than letting the PR OP removing it.
In 2.x version there could be one bulk PR that deletes all of those spaces. If this is not wanted it could go also along with every PR.

Personally I'd love to see no file having trailing whitespace. If this is not wanted, also not a problem.

@akarnokd
Copy link
Member

My grief is when unrelated content changes due to these settings. Otherwise I don't mind if a PR contains extra spaces.

@akarnokd akarnokd changed the title [Discussion] Trailing whitespace Trailing whitespace Jun 25, 2016
@JakeWharton
Copy link
Contributor

I spend a non-trivial amount of time doing git add -p and editing diffs so reduce whitespace changes. I've even resorted to turning off "trim trailing whitespace" in my editor, which is something I never thought I'd do (and why isn't trimming the default in every editor?).

@vanniktech
Copy link
Collaborator Author

vanniktech commented Jun 25, 2016

@JakeWharton I've been using the solution proposed here to not waste my time dividing and adding individual chunks.

git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero - did the job for me. Only stages chunks that contain valid changes and ignores white space only changes.

Nonetheless I feel like trimming trailing whitespace should be the default option and no one would need to go through those magic git tips to create a PR here.

@JakeWharton
Copy link
Contributor

Looks like it didn't work on your PR though. I already need to use -p to
"fix" the star imports as well.

On Sat, Jun 25, 2016, 4:10 PM Niklas Baudy notifications@github.com wrote:

@JakeWharton https://github.com/JakeWharton I've been using the
solution proposed here
http://stackoverflow.com/questions/3515597/add-only-non-whitespace-changes
to not waste my time dividing and adding individual chunks.

git diff -U0 -w --no-color | git apply --cached --ignore-whitespace
--unidiff-zero - did the job for me. Only stages chunks that contain
valid changes and ignores white space only changes.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#4123 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAEEEagOXNEvSproCU2ZOznZCSS46da_ks5qPYtIgaJpZM4I-ZXe
.

@vanniktech
Copy link
Collaborator Author

True I first created the PR containing the whitespace changes. After that I fixed it and force pushed it. All whitespaces are preseverd now.

Yes the star imports are another problem ...

@akarnokd
Copy link
Member

I don't mind whitespaces or if you removed them in PRs anyomore but I won't bother removing them in my PRs.

How about everybody posts with what whitespace settings he/she sees adequate?

@vanniktech
Copy link
Collaborator Author

How about configuring your IDE so that it'll strip them out automatically?

@vanniktech
Copy link
Collaborator Author

@akarnokd are you willing to merge one PR that removes all of the trailing white space and nothing else in 2.x branch? After that a simple Checkstyle rule could be added to enforce no trailing whitespace anymore. There are also options available in Eclipse to automate this.

@akarnokd
Copy link
Member

akarnokd commented Sep 7, 2016

PR yes, Checkstyle no. It complains about too much thing and setting it up for a fresh checkout is non-trivial. How about writing some code in build.gradle that scans through the files before build and lists those lines where they are still there?

@akarnokd
Copy link
Member

akarnokd commented Sep 7, 2016

But please wait with the PR until I post my cleanup/enhancements of today.

@vanniktech
Copy link
Collaborator Author

Alright will do 👍

@akarnokd
Copy link
Member

akarnokd commented Sep 8, 2016

Closing via #4500 and #4496.

@akarnokd akarnokd closed this as completed Sep 8, 2016
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

3 participants