Is there a defined set of rules for ZenPhoto's source code formatting? I've noticed that the line endings are a mixup of Windows and Unix. I've also noticed that the indentation is manually spaced?
I've been meaning to write this up formally, but in general:
- 2-space tabs, manual spaces. - Good C-style syntax ala K&R ( http://en.wikipedia.org/wiki/Indent_style#K.26R_style ) with some minor modifications, namely function braces are to be on the same line (as this looks better for PHP). - Liberal use of space (between names/brackets, operators, lines, etc) - Line endings should be Unix only, I'll fix this.
I am considering switching to tabbed tabs only, as there's too much variation right now. When it was just me it didn't matter as all my tabs were the same, but now for each to have their own tab-size preferences, I think it'd be better to have hard tabs.
All of these are easy to fix with jEdit and a couple regexps. :-)
Essentially, wherever there is a CRLF the CR needs to be removed. The easiest way to do it is to feed every file to dos2unix. I can create an SVN diff if you would like. I submitted one patch already, but it is out of date now.
I see that. You might want to provide some feedback to the user that the script has actually run. That is the only difference between my implementation and yours.
While I agree that it's better to have some consistency in the source base, personally I'd prefer it to be spaces to tabs. There's no standard tabstop value - they vary widely across users/printers and applications. Users can be said to make their own choice, but many don't and the defaults is generally 4 or 8 spaces per tab. HTML/PHP code results in lots of nesting and it just crawls too far across the screen - as an example, the diffs on Trac seem to have 7 spaces per tab and are definitely harder to read when the code has hard tabs than 2 or three spaces. http://www.zenphoto.org/trac/changeset/1124 Anyway, I'm not that bothered myself, but I just thought I'd express an alternative opinion.
Spaces for tabs are insanely annoying. They make navigating the code a real pain. I can understand wanting to use them when 80 characters is all that would fit on the screen, but it's a silly concept now.
Comments
- 2-space tabs, manual spaces.
- Good C-style syntax ala K&R ( http://en.wikipedia.org/wiki/Indent_style#K.26R_style ) with some minor modifications, namely function braces are to be on the same line (as this looks better for PHP).
- Liberal use of space (between names/brackets, operators, lines, etc)
- Line endings should be Unix only, I'll fix this.
I am considering switching to tabbed tabs only, as there's too much variation right now. When it was just me it didn't matter as all my tabs were the same, but now for each to have their own tab-size preferences, I think it'd be better to have hard tabs.
All of these are easy to fix with jEdit and a couple regexps. :-)
Haven't figured out the win vs. unix line ending thing, but I'll let you know when I do. In any case it shouldn't affect the program (clearly).
The hard tabs will save my sanity. Thank you
Just doing the whole shebang at once.
http://www.zenphoto.org/trac/changeset/1124
Anyway, I'm not that bothered myself, but I just thought I'd express an alternative opinion.