Coding guidelines reminder

Coding guidelines reminder

par Martin Dougiamas,
Nombre de réponses : 0
Avatar Core developers Avatar Documentation writers Avatar Moodle HQ Avatar Particularly helpful Moodlers Avatar Plugin developers Avatar Testers
I hate to be a big pedantic baddy, but ... can I please ask people writing Moodle code to read the coding guidelines carefully, and in particular to think about the formatting of things like if-else statements so that they fit in with the existing code?

GOOD:

if ($blah or $blah) {
    stuff();
} else if ($bloo) {
    otherstuff();
}

NOT GOOD:

if ($blah or $blah)             << no brackets
    stuff();
elseif ($bloo)                  << should be "else if"
    otherstuff();


if($blah or $blah) {            << no space after if
     stuff();
}
elseif ($bloo) {                << elseif and on new line

   otherstuff();                  << indenting not 4 spaces
}

 
Moyenne des évaluations  -