[RCD] Codebase cleanup, PSR-1/2 compliance - and before you say no, I'm offering to do the work

David Deutsch skoremail at gmail.com
Fri Aug 30 15:02:51 CEST 2013


Good question! (Also: shame on me for not finding those guidelines ealier
O_o .../awkward/)

I think the basic recommendation that PSR-1 makes on this are pretty sound:
Make a choice and stick with it. As a personal preference, I use StudlyCaps
for classes (this is a 'must' in PSR-1), camelCase for methods and
under_scores for variables. I find that that helps separate the three
concepts, even though it might seem like "hey, why do you use three ways of
doing something". Because it's three separate concepts!

>From what I've seen in the plugins so far, it seems like RCM pretty
consistently uses lowercase_underscored for all three.

Sidenote: My IDE actually gives me a lot of funny warnings about the class
names in RCM - something along the lines of "there is probably a conceptual
error here, somewhere" I always imagine it standing before me with eyes
twitching "dude, this aint right!" ;-)

Sidenote 2: The Guidelines references PEAR standards. I used to really
dislike those, particularly for the ~80 character line limit, which seemed
silly ("Oooh, your b/w terminal can only do 80 characters per line!?").
Fast forward a couple of years and I absolutely love an 80 char line limit.
It's like an addiction to shortness.* There are a couple of outdated things
in there and I might forever think that 4 spaces is silly, but yeah, not as
bad today ;-)

*Sidenote 3: This also helped me come around on Namespaces, really. "use...
as" REALLY helps keep lines short when using classes and particularly when
calling static methods.


On Fri, Aug 30, 2013 at 2:39 PM, taki <taki at alkoholista.hu> wrote:

> 2013-08-29 14:07 időpontban Thomas Bruederli ezt írta:
>
>
>  Thanks for this! Here are some comments about your proposal:
>>
>> * PSR-2 compliance
>>
>> I generally agree to using PSR-2 even if there are some rules that
>> personally I don't like. Especially the if/else newlines.
>>
>
> There's a lots of inconsistency between PSR-1/2 and the current RC
> Dev_Guidelines (http://trac.roundcube.net/**wiki/Dev_Guidelines<http://trac.roundcube.net/wiki/Dev_Guidelines>)
> eg. StudlyCaps and camelCase in class and method names. Anyone wants to
> clarify the current rules? I want to create a ruleset for PHP_CodeSniffer.
>
> --
> Sandor Takacs
>
> ______________________________**_________________
> Roundcube Development discussion mailing list
> dev at lists.roundcube.net
> http://lists.roundcube.net/**mailman/listinfo/dev<http://lists.roundcube.net/mailman/listinfo/dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.roundcube.net/pipermail/dev/attachments/20130830/ebe90472/attachment-0001.html>


More information about the dev mailing list