Coding guidelines reminder

Coding guidelines reminder

by Martin Dougiamas -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of 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
}

 
Average of ratings: -