Coding guidelines reminder

Coding guidelines reminder

autor Martin Dougiamas -
Počet odpovědí: 0
Obrázek: Core developers Obrázek: Documentation writers Obrázek: Moodle HQ Obrázek: Particularly helpful Moodlers Obrázek: Plugin developers Obrázek: 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
}

 
Průměr hodnocení: -