Re: [zeta-dev] Documenting our coding style
Hi, On Fri, Nov 26, 2010 at 2:23 PM, Derick Rethans der...@apache.org wrote: On Tue, 16 Nov 2010, Tobias Schlitt wrote: for another project I needed to give advice on the coding standard used by Apache Zeta Components. There is some very old version of the eZ Publish coding style in [1] (from 2001) but no reliable, recent source. So I think we should document our coding style on the website. Please complete / correct my following brainstorming: - Indentation with 4 spaces - After a { - On breakup of long lines ( 78 chars) after a ( - { and } on a new line - 1 space after ( and before ) - No space after [ and before ] - 1 space after , - 1 space before and after . - Almost always camelCase - classes always start with ezc followed by an upper case char - constants all in upper case with _ There is also a script at http://svn.apache.org/repos/asf/incubator/zetacomponents/scripts/syntax-check.sh that has a few rough automated checks. I remember I used a PHP Code Sniffer standard for ZC is it still available somewhere ? I tried the old URL and it seems it's no longer there. Best Regards, -- Jérôme Renard http://39web.fr | http://jrenard.info | http://twitter.com/jeromerenard
Re: [zeta-dev] Documenting our coding style
I saved in my bookmarks this one : http://pear.xplib.de/get/ http://pear.xplib.de/get/Max 2010/11/27 Jerome Renard jerome.ren...@gmail.com Hi, On Fri, Nov 26, 2010 at 2:23 PM, Derick Rethans der...@apache.org wrote: On Tue, 16 Nov 2010, Tobias Schlitt wrote: for another project I needed to give advice on the coding standard used by Apache Zeta Components. There is some very old version of the eZ Publish coding style in [1] (from 2001) but no reliable, recent source. So I think we should document our coding style on the website. Please complete / correct my following brainstorming: - Indentation with 4 spaces - After a { - On breakup of long lines ( 78 chars) after a ( - { and } on a new line - 1 space after ( and before ) - No space after [ and before ] - 1 space after , - 1 space before and after . - Almost always camelCase - classes always start with ezc followed by an upper case char - constants all in upper case with _ There is also a script at http://svn.apache.org/repos/asf/incubator/zetacomponents/scripts/syntax-check.sh that has a few rough automated checks. I remember I used a PHP Code Sniffer standard for ZC is it still available somewhere ? I tried the old URL and it seems it's no longer there. Best Regards, -- Jérôme Renard http://39web.fr | http://jrenard.info | http://twitter.com/jeromerenard
Re: [zeta-dev] Documenting our coding style
Maxime, On Sat, Nov 27, 2010 at 10:29 AM, Maxime Thomas maxime.t...@gmail.com wrote: I saved in my bookmarks this one : http://pear.xplib.de/get/ http://pear.xplib.de/get/Max Cool, thanks :) -- Jérôme Renard http://39web.fr | http://jrenard.info | http://twitter.com/jeromerenard
Re: [zeta-dev] Documenting our coding style
On Tue, 16 Nov 2010, Tobias Schlitt wrote: for another project I needed to give advice on the coding standard used by Apache Zeta Components. There is some very old version of the eZ Publish coding style in [1] (from 2001) but no reliable, recent source. So I think we should document our coding style on the website. Please complete / correct my following brainstorming: - Indentation with 4 spaces - After a { - On breakup of long lines ( 78 chars) after a ( - { and } on a new line - 1 space after ( and before ) - No space after [ and before ] - 1 space after , - 1 space before and after . - Almost always camelCase - classes always start with ezc followed by an upper case char - constants all in upper case with _ There is also a script at http://svn.apache.org/repos/asf/incubator/zetacomponents/scripts/syntax-check.sh that has a few rough automated checks. regards, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug
Re: [zeta-dev] Documenting our coding style
Hi Thomas, On 11/16/2010 01:32 PM, Maxime Thomas wrote: What are the limit cases for this one : Almost always camelCase ? I listed the cases directly below this point. Actually, only constants are an exception to the camelCase rule. I would like to add a semantic rule to that about function naming. Function names must be : - Short - Explicit - Use verbs as first name : get, put, set, call, fetch, send... - Be always lowered camelCased This kind of stuff is already documented here: http://incubator.apache.org/zetacomponents/community/implementation.html I also would like to add another semantic rule about variable naming : - if attribute of class : must be camelCased - if local variable : must be url styled : lowered and white caracters escape with underscore I'm sorry, but that is not how we code in Zeta. We use camelCase everywhere and the idea should not be to change a coding standard, but to document it properly. For comment, I guess we will follow the same as eZPublish, good rule of thumb, or inherit from PEAR, a good start and easily pluggable into phpunit. Do we have to set the encoding settings of the files (UTF-8, Unix Style) ? We use UTF-8 everywhere. For SVN you are best of with svn:eol-style set to native. Regards, Toby -- Tobias Schlitthttp://schlitt.infoGPG Key: 0xC462BC14 Want to hire me? Need quality assurance?http://qafoo.com eZ Components are Zeta Components now! http://bit.ly/9S7zbn