Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue15550] Trailing white spaces

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Aug 3, 2012, 8:40 AM

Post #1 of 17 (172 views)
Permalink
[issue15550] Trailing white spaces

New submission from Serhiy Storchaka:

My editors are configured to remove trailing spaces (this is useful for removing artifacts of indentation). The flip side of this is that my patches sometimes contain unrelated trailing spaces fixes.

Trailing spaces are not significant in any CPython source file, their presence I believe mistake. Easier once we remove all spaces and then prevent the appearance of new, than constantly face to unrelated changes. I'm not attaching a patch (it is too big, over 5 MB), anyone can create it by the following commands:

hg status -cn | tr '\n' '\0' | xargs -0 sed -i -re 's/[ \t]+$//'

It would be good if the Mercurial would had hook, which automatically remove trailing spaces or prohibit to commit patches that contain trailing spaces.

----------
messages: 167337
nosy: storchaka
priority: normal
severity: normal
status: open
title: Trailing white spaces
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 3, 2012, 12:58 PM

Post #2 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Serhiy Storchaka added the comment:

Because CPython repository contains binary files too, they should be reverted:

hg diff | sed -nre 's/^Binary file (.*) has changed/\1/p' | tr '\n' '\0' | xargs -0 hg revert

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 3, 2012, 1:16 PM

Post #3 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Ned Deily added the comment:

There already is a hook in place for the main python.org repository that checks for and rejects changesets that include files with space issues:

http://hg.python.org/hooks/file/bd04c6b37749/checkwhitespace.py

You can add it to your local repo to check patches before they are pushed.

----------
nosy: +ned.deily

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 3, 2012, 2:12 PM

Post #4 of 17 (163 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Antoine Pitrou added the comment:

Or you can use "make patchcheck" which will (hopefully) warn you of such issues.

----------
nosy: +pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 10:10 AM

Post #5 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Chris Jerdonek added the comment:

> There already is a hook in place for the main python.org repository that checks for and rejects changesets that include files with space issues:

If there is already a hook, then why do some files have spurious white space (i.e. at the end of a line)? Is that because those issues were present prior to putting the hook in place?

----------
nosy: +cjerdonek

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 12:14 PM

Post #6 of 17 (160 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Antoine Pitrou added the comment:

AFAIR the hook only applies to Python and reST files, not C files.
I think Georg wrote it, perhaps he knows the reasons.

----------
nosy: +georg.brandl

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 12:35 PM

Post #7 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Serhiy Storchaka added the comment:

> There already is a hook in place for the main python.org repository that
> checks for and rejects changesets that include files with space issues:

Now I understand why there is no problem with .py files. But there are a lot of
other files (including .c and .h) with trailing whitespaces.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 12:43 PM

Post #8 of 17 (166 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Georg Brandl added the comment:

Well, I'm -0 on extending the hook to C files.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 1:49 PM

Post #9 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Serhiy Storchaka added the comment:

I found a few files where trailing spaces are significant (patches, RTF, test data). Excluding them and three generated file (Unicode data, generating scripts should be smarter), I divided the remaining into several parts:

1) the libffi library;
2) the libmpdec library;
3) other C sources;
4) the rest of the files (mainly readme-like files and build scripts).

----------
keywords: +patch
Added file: http://bugs.python.org/file26689/libffi_trailing_whitespaces.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 1:50 PM

Post #10 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Changes by Serhiy Storchaka <storchaka [at] gmail>:


Added file: http://bugs.python.org/file26690/libmpdec_trailing_whitespaces.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 1:51 PM

Post #11 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Changes by Serhiy Storchaka <storchaka [at] gmail>:


Added file: http://bugs.python.org/file26691/c_trailing_whitespaces.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 1:54 PM

Post #12 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Changes by Serhiy Storchaka <storchaka [at] gmail>:


Added file: http://bugs.python.org/file26692/other_trailing_whitespaces.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 1:59 PM

Post #13 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Ned Deily added the comment:

-1 for making wholesale whitespace changes. It potentially makes merging harder for little benefit. Imported files from other projects should definitely not be touched. IMO, the only thing potentially worth considering is extending the existing hook to C files. I'm +0 on that myself.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 4, 2012, 2:35 PM

Post #14 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Stefan Krah added the comment:

I'm not against whitespace cleanup every now and then, but also -0
on a hook for C files. I think that (for C) the annoyance of having
a patch rejected because of trailing whitespace outweighs the
overall benefit.

----------
nosy: +skrah

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 5, 2012, 7:09 PM

Post #15 of 17 (165 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Terry J. Reedy added the comment:

How is it more of a nuisance for C files than for .py files?
Editor 'trim trailing' tools certainly don't care.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 5, 2012, 8:55 PM

Post #16 of 17 (161 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Chris Jerdonek added the comment:

Out of curiosity, is there a mechanism to bypass the hook on a per-file basis, if necessary? FWIW, the WebKit open source project had a similar hook (for SVN) to prevent the inclusion of tabs in source files, and a custom SVN property was used to bypass the check on a per-file basis.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 8, 2012, 1:58 AM

Post #17 of 17 (143 views)
Permalink
[issue15550] Trailing white spaces [In reply to]

Ned Deily added the comment:

Since we've established that python files are already covered by 'make patchcheck' and the hg checkin hook and that there does not appear to be much enthusiasm for extending the hook to C files or to wholesale whitespace cleanup, the remaining issue is whether to extend 'make patchcheck' for C files. And that is the subject of open Issue8912. So I'm going to close this issue as a duplicate of that one and suggest further discussion take place there. As for a per-file bypass, I'm not aware of any nor of any need that has arisen so far for one.

----------
resolution: -> duplicate
stage: -> committed/rejected
status: open -> closed
superseder: -> `make patchcheck` should check the whitespace of .c/.h files

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.