Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Peer reviewing: Difference between revisions

From MoodleDocs
(Proofing and reorganisation)
Line 1: Line 1:
==Peer review check-list==
These are points to consider while peer-reviewing issues. They can also be applied when solving issues, to reduce the likelihood of problems during peer-review and integration.
 
=The checklist=
 
==Syntax==
To allow the community of Moodle developers to work together, conventions should be followed.
 
* the code is easy to understand and where it isn't, comments have been provided;
* variables are named correctly (all lower case, no camel-case, no underscores);
* functions are named correctly (all lower case, no camel-case, underscores allowed);
* PHP DocBlocks have been updated and adhere to [[Coding_style#Documentation_and_comments|coding style guide]];
* the code doesn't use [[Deprecated_functions_in_2.0|deprecated functions]]; and
* $_GET, $_POST, $_REQUEST, $_COOKIE, and $_SESSION are never used.
 
See the [[Coding style]] guide for details.


These are points to consider while peer-reviewing issues. They can also be applied when solving issues, to reduce the likelihood of problems during peer-review and integration.
==Whitespace==
Unnecessary whitespace changes can cause conflicts when committing code.


===Syntax===
Ensure that:
Ensure that:
* there are no unnecessary blank lines in the new code;
* there are no unnecessary blank lines in the new code;
* blank lines do not contain spaces;
* blank lines do not contain spaces;
* variables are named correctly (all lower case, no underscores);
* there are no unnecessary changes to whitespace in other areas on the file;
* functions are named correctly; and
* there are no unnecessary changes to whitespace in other areas on the file.
* new strings Don't Use Camel Case


See the [[Coding style]] guide for details.
==Output==
Output needs to be controlled by renderers to achieve consistency and correct application of themes.
 
Ensure that:
* output renders are used to generate output strings, including HTML tags;
* HTML output is valid XHTML;
* no inline styles have been used in HTML output (everything has to be in CSS);
* CSS has been added to the appropriate CSS files (base, specific area, sometimes canvas); and
* the code doesn't use buffered output unless absolutely necessary.
 
==Language==
To achieve appropriate internationalisation of Moodle, language strings must be managed correctly.


===Output===
Ensure that:
Ensure that:
* the code doesn't use buffered output unless absolutely necessary; and
* new language strings are named correctly (all lower case, no camel-case, underscores are permissible in some cases);
* lang-strings are used instead of hard-coded strings for text output.
* language strings are used instead of hard-coded strings for text output;
* language strings have not been removed or renamed in stable branches (permitted only in master); and
* AMOS commands have been specified when moving, copying, or deleting language strings.


===Databases===
==Databases==
If there is SQL code you can test quickly, do so.  
DB calls are the greatest performance bottleneck in Moodle.
 
If there is SQL code you can test quickly then do so.  


Ensure that:
Ensure that:
* there are minimal DB calls (no excessive use of the DB); and
* there are minimal DB calls (no excessive use of the DB); and
* the code uses SQL compatible with all the supported DB engines.
* the code uses SQL compatible with all the supported DB engines (check all selected fields appear in an 'order by' clause).
 
==Testing==
All code must be tested before integration. If testing instructions are insufficient, it's likely to cause more work down the track.


===Misc===
Ensure that:
Ensure that:
* the code seems to solve the described problem;
* there are specific testing instructions that state how, as well as what, to test;
* there are specific testing instructions that state how, as well as what, to test;
* the code doesn't use deprecated functions (see [https://docs.moodle.org/dev/Deprecated_functions_in_2.0 Deprecated functions in 2.0]);
* new unit tests have been added when there is a change in functionality; and
* the code makes sense in the broader scheme of things (look at the whole function, not just the altered code); and
* unit tests pass for related areas where changes have been made.
* the code is easy to understand, and where it isn't, comments have been provided.
 
* It doesn't break XHTML
==Security==
* It doesn't remove strings, or rename strings from stable branches (permitted only in master)
The user community relies on Moodle being responsibly secure.
* php docs have been updated and adhere to coding style guide
 
* The idea/solution makes sense and is complete.
Ensure that:
* The developer has searched for and fixed other areas that may also have been affected (provided they are in the scope of the original issue)
* User login is checked where an identity is needed;
* String changes include AMOS syntax where required (moving, copying, deleting strings)
* Sesskey values are checked before all write actions where appropriate (some read actions as well); and
* No inline styles have been used in HTML output (everything has to be in CSS)
* Capabilities are checked where roles differ.
* CSS has been added to the appropriate CSS files (base, specific area, sometimes canvas)
 
* $_GET, $_POST, $_REQUEST, $_COOKIE, and $_SESSION are never used
==Documentation==
* Unit tests all pass for related areas where changes have been made
Work does not stop when code is integrated.
* Uses sesskey for all write actions where appropriate (some read actions as well although not as common)
 
Ensure that:
* Appropriate [[Tracker_issue_labels|labels]] have been added when there has been a function change, particularly
** qa_test_required (significant functional change),
** docs_required (any functional change, usually paired with ui_change),
** ui_change (any functional change, usually paired with docs_required, except ui_change remains permanetly), and
** dev_docs_required (any change to APIs).


===Tracker===
==Git==
Ensure that:
Ensure that:
* Appropriate labels are added if needed (see [https://docs.moodle.org/dev/Tracker_issue_labels Tracker Issue Labels])
* the commit message includes the tracker issue number and the component (ideal format is <code>MDL-xxxx Component Commit message</code>);
* Testing instructions are present and sufficient for a developer to follow
* the Git history is clean and the work has been rebased to minimal commits; and
* the original author of the work provided as a patch has been given credit within the commit (as author of in the commit message if changes were made).


===GIT===
==Misc==
Ensure that:
Ensure that:
* The commit message includes the tracker issue number and the component. Ideal format is <code>MDL-xxxx Component Commit message</code>
* the code seems to solve the described problem completely (or that further issues have been created to resolve remaining parts);
* The GIT history is clean and the work has been rebased in to as few commits as is necessary
* the code makes sense in relation to the broader codebase (look at the whole function, not just the altered code); and
* The original author of the work has been given credit within the commit (as author of in the commit message if changes were made)
* the developer has searched for and fixed other areas that may also have been affected.


==See Also==
=See Also=
* [http://moodle.org/plugins/view.php?plugin=local_codechecker Code checker plugin]
* [http://moodle.org/plugins/view.php?plugin=local_codechecker Code checker plugin]

Revision as of 02:28, 15 February 2012

These are points to consider while peer-reviewing issues. They can also be applied when solving issues, to reduce the likelihood of problems during peer-review and integration.

The checklist

Syntax

To allow the community of Moodle developers to work together, conventions should be followed.

  • the code is easy to understand and where it isn't, comments have been provided;
  • variables are named correctly (all lower case, no camel-case, no underscores);
  • functions are named correctly (all lower case, no camel-case, underscores allowed);
  • PHP DocBlocks have been updated and adhere to coding style guide;
  • the code doesn't use deprecated functions; and
  • $_GET, $_POST, $_REQUEST, $_COOKIE, and $_SESSION are never used.

See the Coding style guide for details.

Whitespace

Unnecessary whitespace changes can cause conflicts when committing code.

Ensure that:

  • there are no unnecessary blank lines in the new code;
  • blank lines do not contain spaces;
  • there are no unnecessary changes to whitespace in other areas on the file;

Output

Output needs to be controlled by renderers to achieve consistency and correct application of themes.

Ensure that:

  • output renders are used to generate output strings, including HTML tags;
  • HTML output is valid XHTML;
  • no inline styles have been used in HTML output (everything has to be in CSS);
  • CSS has been added to the appropriate CSS files (base, specific area, sometimes canvas); and
  • the code doesn't use buffered output unless absolutely necessary.

Language

To achieve appropriate internationalisation of Moodle, language strings must be managed correctly.

Ensure that:

  • new language strings are named correctly (all lower case, no camel-case, underscores are permissible in some cases);
  • language strings are used instead of hard-coded strings for text output;
  • language strings have not been removed or renamed in stable branches (permitted only in master); and
  • AMOS commands have been specified when moving, copying, or deleting language strings.

Databases

DB calls are the greatest performance bottleneck in Moodle.

If there is SQL code you can test quickly then do so.

Ensure that:

  • there are minimal DB calls (no excessive use of the DB); and
  • the code uses SQL compatible with all the supported DB engines (check all selected fields appear in an 'order by' clause).

Testing

All code must be tested before integration. If testing instructions are insufficient, it's likely to cause more work down the track.

Ensure that:

  • there are specific testing instructions that state how, as well as what, to test;
  • new unit tests have been added when there is a change in functionality; and
  • unit tests pass for related areas where changes have been made.

Security

The user community relies on Moodle being responsibly secure.

Ensure that:

  • User login is checked where an identity is needed;
  • Sesskey values are checked before all write actions where appropriate (some read actions as well); and
  • Capabilities are checked where roles differ.

Documentation

Work does not stop when code is integrated.

Ensure that:

  • Appropriate labels have been added when there has been a function change, particularly
    • qa_test_required (significant functional change),
    • docs_required (any functional change, usually paired with ui_change),
    • ui_change (any functional change, usually paired with docs_required, except ui_change remains permanetly), and
    • dev_docs_required (any change to APIs).

Git

Ensure that:

  • the commit message includes the tracker issue number and the component (ideal format is MDL-xxxx Component Commit message);
  • the Git history is clean and the work has been rebased to minimal commits; and
  • the original author of the work provided as a patch has been given credit within the commit (as author of in the commit message if changes were made).

Misc

Ensure that:

  • the code seems to solve the described problem completely (or that further issues have been created to resolve remaining parts);
  • the code makes sense in relation to the broader codebase (look at the whole function, not just the altered code); and
  • the developer has searched for and fixed other areas that may also have been affected.

See Also