Skip to content
Robin Wohlers-Reichel edited this page Nov 1, 2018 · 4 revisions

Traceability

  • Pull request must trace to a deliverable according to the contribution guidelines. This is the responsibility of the person assigned to the pull request.

Comments

  • Docstrings/module descriptions at top of module with author(s), most recent date modified and description of what the module contains (max 5 sentences)
  • Docstrings/function descriptions for functions/classes with brief description of function, parameters and data to be returned. Description shall not exceed 2 sentences (exceptions may be applied). Situated in the lines directly above the code for the function/class.
  • Comments for large blocks of code that appear hard to understand at quick glance
  • Comments for variables that aren't self-descriptive
  • Check if comments have been changed if corresponding code has fundamentally changed
  • For Python: #... for comments in code, """...""" for docstrings. For Java/JS: //... for single line comments, /*..*/ for docstrings
  • Single line comments have delimiters on the same line
  • Multi line comments have their ending delimiter at on a separate line

Naming

  • Use of camel case
  • Relevant and as descriptive as possible, but also succinct (ie: i will be preferred to IndexToScanThroughTheArrayOfRestaurantTables) and consistent with code in the project
  • Avoidance of characters with similarities to numbers for single char names (ie: lowercase letter 'l' number '1' and letter 'O' and number '0')

Indentation and structure

(though this really should be picked up by the tools)

  • Declarations of variables/constants/macros/packages at the top of the module (after the module description/docstring) or function with variables preferably initialised
  • Code indented at intervals of 4 spaces in with no use of tabs
  • Opening braces on same line
  • Separate line for closing braces
  • Width of code shall not exceed the width of page at 100% zoom. Code that needs to continue onto a new line must be indented accordingly
  • Space of a single line to separate blocks of code that segment large blocks of code to make it more readable. The code should be segmented according to a specific action in the function that the segment is doing

For those who want to look into it: the in-depth standard for coding style and