Pending

User tests: Successful: Unsuccessful:

avatar elkuku
elkuku
25 Jan 2012

This is an attempt to bring the CMS coding standards in line with the Joomla! platform.
I believe that this is going to be a long way, so this is the first baby step ;)
This will:

  • Add a phing build.xml file containing the code sniffer commands and the CMS fileset.
  • Add the ruleset.xml from the platform. Some generic sniffs have not been included (yet).
  • Add the first custom Joomla! Coding standard sniff (Joomla_Sniffs_WhiteSpace_DisallowSpaceIndentSniff).
  • Fix the PHP code according to the present rules.

List of used sniffs (8):

  • Joomla_Sniffs_WhiteSpace_DisallowSpaceIndentSniff
  • PEAR_Sniffs_NamingConventions_ValidClassNameSniff
  • PEAR_Sniffs_Classes_ClassDeclarationSniff
  • PEAR_Sniffs_Commenting_InlineCommentSniff
  • Generic_Sniffs_Files_LineEndingsSniff
  • PEAR_Sniffs_Formatting_MultiLineAssignmentSniff
  • Generic_Sniffs_NamingConventions_UpperCaseConstantNameSniff
  • Generic_Sniffs_PHP_DisallowShortOpenTagSniff

Most common errors:

  • Class names have to start with an upper case letter, the opening brace must be on a new line.
  • Spaces were used for indenting instead of tabs.
  • Windows line endings instead of Unix.

I hope this will continue and being used before merging pull requests or applying patches.

joomlacode.org bug tracker: #27837

avatar elkuku elkuku - open - 25 Jan 2012
avatar simbus82
simbus82 - comment - 25 Jan 2012

I really like your suggestion! I hope the team seriously consider your suggestion!

avatar elinw
elinw - comment - 2 Feb 2012

This is awesome.

avatar elkuku
elkuku - comment - 5 Feb 2012

And will be unmergeable pretty soon - could you please merge or close with a comment like: we don't care about coding standards.. we're goint to take a different approach.... somebody else is already taking care of it... - or something else ;)

I feel ignoring pull requests is just very discouraging - not only for me.

avatar mbabker
mbabker - comment - 6 Feb 2012

Personally, I think that coding standards need to be applied, but I think it will probably wait until we have truly split off the master branch for 3.0 development. If we tried to push it into the 2.5 series, we would end up with rather large update packages for no reason other than code style. 3.0 should be the release that we get code style standardized, and for those with the tools to do it (which is everyone, most IDE's can be configured to match most of our code style rules), it will be a simple task to accomplish (I did it while incorporating my batch process changes going into 2.5 by stylizing files as I edited them).

avatar elkuku
elkuku - comment - 6 Feb 2012

Well that makes a lot of sense. So if this is put on hold (officially) until there is a 3.0 branch - fine with me.

avatar realityking
realityking - comment - 6 Feb 2012

I'd be in favor of getting the general system and some basic sniffs in now. This way people have a way of checking their code style for stuff they work on now (as if that anyone does that) and more importantly what we do now we don't have to do later. Also we may wanna set up jenkins for reports sooner rather than later and this would be a good first step.

@elkuku Is there an issue on the tracker for this? I'm afraid without it this will go unnoticed by the maintainers.

avatar elkuku
elkuku - comment - 6 Feb 2012

@realityking yes, the link to the corresponding tracker item is in the first post (at the very end).

avatar oc666
oc666 - comment - 15 Mar 2012

IMHO, in addition to mbabker comment about doing this on 3.0 branch, I hope we'll have some unit tests for 3.0 branch, what will make this change less risky (although is just code styling).

avatar elinw
elinw - comment - 15 Mar 2012

I'm just really really anxious to get going with this in general. let's get a branch gong ASAP.

avatar elkuku elkuku - close - 29 Jul 2012
avatar elkuku
elkuku - comment - 29 Jul 2012

Added to the book of useless contribution attempts :disappointed:

avatar mbabker
mbabker - comment - 29 Jul 2012

FWIW, what's left of this pull that's not already applied to master - https://github.com/mbabker/joomla-cms/compare/elkuku_sniff

avatar elkuku
elkuku - comment - 29 Jul 2012

Thanks for the heads up, so it wasn't that useless ;)

avatar infograf768 infograf768 - reference | - 10 Aug 12

Add a Comment

Login with GitHub to post a comment