After a discussion in #drupal, decided to be consistant with trailing newlines in core files. Going to do a search-replace for '\W+\Z' in core and get a patch up.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | EOF-fixing.patch | 31 KB | alexanderpas |
| #10 | 320114-coding-standards-ending-newlines-D7.patch | 30.28 KB | dave reid |
| #9 | 320114-coding-standards-ending-newlines-D7.patch | 32.76 KB | dave reid |
Comments
Comment #1
webchickComment #2
dave reidComment #3
chx commentedyou will get a "no ending newline" from patch if that's missing imo... it does no harm and sometimes you need to fight your editor to not add one.
Comment #4
dave reidMaybe we should consider making sure all core files have an ending newline? Getting the no ending newline patch warning is something that might confuse novices and make them think they had done something wrong (like I had for a while when I first started patching core).
If not, feel free to mark as won't fix again.
Comment #5
JamesAn commentedThe only file in a clean installation of HEAD matching the pattern '\W+\Z' is misc/jquery.js, but it has a trailing end line. Can we consider this fixed?
Comment #6
JamesAn commentedWhile I'm at it, let's set the status to move this issue along.
Does someone want to confirm that all core files have a trailing newline?
Comment #7
mcrittenden commentedmisc/jquery.js is the only one that comes up for me, too.
Comment #8
dave reidThat's no longer the pattern that needs to be checked. We want to ensure that all files in core end in exactly one new line, which matches several files.
Comment #9
dave reidComment #10
dave reidOops...left a spare part of a contact.module patch in there.
Comment #11
mcrittenden commentedWent through the first 15 or so changes and everything checked out. Patch applies cleanly and works fine. Follows standards. Don't really know how to review it except to say that :).
Comment #13
JamesAn commentedLet's retest.
Comment #15
JamesAn commentedBump..
The patch no longer works due to all the intervening changes to the code. Is there some automated process to pick out all files in core that don't end in one new line and make them end in exactly one new line?
I'd reroll this if I knew how, but I suspect I'm going to waste a lot of time playing around with line endings...
Comment #16
alexanderpas commentedrerolled, temporarily critical, due to amount of changes.
this patch was made possible thanks to the song Code Monkey by Jonathan Coulton
http://www.jonathancoulton.com/2006/04/14/thing-a-week-29-code-monkey/
Comment #17
alexanderpas commentedComment #19
alexanderpas commentedwhat happened bot?
- Failed to install HEAD
- WTF??? stupid bot!!!
Comment #21
alexanderpas commenteddo not trust the bot: http://testing.drupal.org/node/33
Comment #23
lilou commentedSetting to previous status - testbot was broken (failed to install).
Comment #24
alexanderpas commentedand it passes, testbot is not broken anymore :D
note that there are no new-line warnings in the adds, and all newline removals were duplicate newlines at the end of the file.
Comment #25
JamesAn commentedThanks for that.
How'd you find the files with newline problem? Was it just figuring out the right regex string?
Comment #26
alexanderpas commenteddid not even used regex ;)
0) remove CVS and binary (images) files!!!
1) append unique identifier to all and every file
2) search and replace magic
3) create intermediate.patch
4) check out CVS again
5) apply intermediate patch to clean CVS checkout
6) no problems :D
7) cvs diff
8) patch ready!
Comment #27
JamesAn commentedOh. I see..
I was hoping for a quick way of doing it. =P Turns out, grep can't search across multiple lines anyway...
Comment #29
webchickThis isn't critical.
I'm also heavily considering "won't fix"ing this. I don't think we'll ever reach a point where everyone's editors aren't (re-)introducing/stripping these trailing whitespaces, so this kind of feels like a fight we're never going to win.
Comment #30
dave reidIf we can get the core committers to run patches through some kind of automatic coder review, it won't matter anymore. That would be sweet. :) My original point is that newbies creating patches that don't have an ending new line are going to see those wacky lines in their patches and will freak out thinking they did it wrong.
Comment #31
sunAt least, we should add this to the coding standards.
/me hates missing newline at end of file
Comment #32
webchicksun: That sounds reasonable. Want to take care of it?
Dave: I know, but there are obviously editors out there that are stripping out trailing newlines, or this wouldn't come up all the time. And rather than core committers doing this, the testing bot should do this. Then it could be fixed way before it ever hits RTBC. I know there must be an issue for this somewhere but I can't find it.
Comment #33
sunMoving to Coder's queue.
Comment #34
dave reid@webchick: Oh yeah having it automated by the bot is a way better idea. I love it!
Comment #35
alexanderpas commentedComment #36
rickmanelius commentedThis issue was marked 'novice' on topic that doesn't have a clear decision made and might be already irrelevant. Shall we mark this closed(won't fix)? Or is there an easy means for a novice to actually fix this :)
Comment #37
solotandem commentedLet's not mark this closed (won't fix). However, with the current review code, it may not be a novice item.
Comment #38
rickmanelius commentedRemoving 'novice' tag and setting to "close won't fix" as per #37, #29, and the fact that this might be solvable.... or by some automated solution listed/discussed in #34. But I'm happy to have this reopened if someone feels strongly enough that it should still be done.