Details

    • Type: Sub-task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: Coding style
    • Labels:
      None

      Description

      Partially motivated by the great blog post by Sam Marshall at http://learn1.open.ac.uk/mod/oublog/viewpost.php?post=590 and partially motivated by my own experience (recently discussed in September in MDL-42190 peer-review for example), I am proposing the following changes in the https://docs.moodle.org/dev/Coding_style

      (A) In the "Wrapping Arrays" section, modify the example so that the => operators are not lined up and remove the mention of it being optional. Put a new note that such an alignment is discouraged. So that the recommended layout is

      $plugininfo['preferences'][$plugin] = array(
          'id' => $plugin, 
          'link' => $pref_url, 
          'string' => $modulenamestr
      );
      

      (B) Remove the "Wrapping function declarations" section. I do not have many objective arguments against it but I simply do not like it. I believe we should not waste valuable space on the left given the limited line length. Additionally, I suspect that vast majority of the existing code does not follow this style anyway.

      So my proposal is to remove that section or replace it with a note that functions with long list of parameters may be sign of a bad signature design but otherwise the standard wrapping rules apply (that is use 8 spaces for the second and following lines).

      public function graded_users_iterator($course, $grade_items = null,
              $groupid = 0, $sortfield1 = 'lastname', $sortorder1 = 'ASC',
              $sortfield2 = 'firstname', $sortorder2 = 'ASC') {
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated: