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 white spaces #59755
Comments
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:
It would be good if the Mercurial would had hook, which automatically remove trailing spaces or prohibit to commit patches that contain trailing spaces. |
Because CPython repository contains binary files too, they should be reverted:
|
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. |
Or you can use "make patchcheck" which will (hopefully) warn you of such 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? |
AFAIR the hook only applies to Python and reST files, not C files. |
Now I understand why there is no problem with .py files. But there are a lot of |
Well, I'm -0 on extending the hook to C files. |
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 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. |
I'm not against whitespace cleanup every now and then, but also -0 |
How is it more of a nuisance for C files than for .py files? |
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. |
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 bpo-8912. 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. |
make patchcheck
should check the whitespace of .c/.h filesNote: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: