On Oct 19, 10:29 am, Wilco Jansen <
jansen.wi...@gmail.com> wrote:
> You bring up a point that I ran in to when researching the
> possibilities for getting an continuous integrated environment up and
> running for Joomla (seehttp://
jfoobar.org/blog/303-continuous-integration-in-php-a-closer-lo...
> the full article about my findings). If you run a code sniffer (phpcs)
> and use the coding standards of Joomla (which derived from the PEAR
> standards), you will find a ton of inconsistencies in the current codebase,
> this includes class/method definitions and also usage of naming conventions.
I can try and put together a custom coding standard for the php code
sniffer (phpcs) if there's any interest in using it. From what I've
been able to determine so far, the joomla divergences from PEAR
standards are:
1) No defined max line length (PEAR is 85 chars)
2) Required Doc Blocks differ between file and class docblock (PEAR is
the same docblock for each)
Joomla File block: version, package, copyright, and license, in
that order, all required.
Joomla Class block: package, subpackage, link, see, since,
deprecated, in that order, (only "package" required to be there?)
3) Slight difference in version tag (PEAR requires CVS: or SVN: at
start)
4) Slight difference in syntax of copyright tag (PEAR is simply year
and copyright holder)
5) Switch/case indents the cases one level (PEAR does not)
6) If statements. Hard to determine the Joomla standard, as the wiki
contradicts both itself and PEAR.
Contradiction:
wiki (<a href="
http://docs.joomla.org/
Coding_style_and_standards">
http://docs.joomla.org/
Coding_style_and_standards</a>) in the Control Structures diagram
shows first this style for else:
} else
{
and then this:
}
else {
while PEAR is:
} else {
I have no idea what should be right (my personal pref is the PEAR
way). Comments? Any other coding bugaboos you want this to rule out?
I can limit the allowed package names if you like, but when I start
getting to specific (for example, forcing the copyright statement to
include 2005-2009 for years) i'd need to go back and tweak the rules
more often, and I'd rather keep the rules as general as possible.
Note: I'm tinkering with one for my own use right now. This question
is more about having an "official" one contributors can use to check
their files against, or which might be a pre-commit hook on subversion
to enforce Joomla coding standards as a step toward continuous
integration. Or, if you'd rather, I can toss my version into my Github
area as an open source project that everyone can contribute to and
pull from as new rules are defined.