[TYPO3-50-general] Coding Guidelines: Rule for long criteria line breaks - Voting

Tim Eilers tim.eilers at web.de
Thu Aug 28 21:41:53 CEST 2008


Hi folks,

while coding Sniffs and reading other people code i often jumped about
long criterias which where breaked into several lines, which is conform
to our currenct coding guideline rule:

----
if (weHaveALotOfCriteria() &&
   notEverythingFitsIntoOneLine() ||
   youJustTendToLikeIt()) {
      doThis();	
----

While this looks easy to read it can be very difficult in complex code.
I would suggest to change the rule to this:

----
if (weHaveALotOfCriteria()
   && notEverythingFitsIntoOneLine()
   || youJustTendToLikeIt()) {
      doThis();
----

Advantage:
You clearly can see, that the line belongs to a longer criteria.

I am interested in your opinion, what do you think?

If all or many will agree, i would also do a Sniff, which checks it.


Cheery,
Timmy.


More information about the TYPO3-project-5_0-general mailing list