Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 1.68 KB

codingStd_top10.md

File metadata and controls

16 lines (13 loc) · 1.68 KB

Coding Standards Top 10

This is a list of the most commonly needed parts of the coding standards. For the complete coding standards click here

  1. Coding standards must be strictly followed for new or heavily modified code, but NOT for unmodified code (unless your only task is to make cosmetic improvements).
  2. General formatting: use lower case throughout, indent blocks by 2 characters, try to confine your line width to 80 characters.
  3. Naming: use descriptive names for variables and procedures, avoid _ except for specific uses (module prefix, _opt and _r4 suffixes), use camelCase to differentiate words.
  4. Layout: put all use statements at beginning of the module (not within procedures), avoid using the only statement, locate the public statements near the top of the source file before everything else, procedure arguments should be declared before local variables.
  5. Encapsulation: as much as possible avoid public module variables, locate variables and procedures in the module that maximizes encapsulation.
  6. For all new modules and procedures, include ! :Purpose: for the automatically generated on-line documentation. Refer to the documentation page for more details.
  7. All namelist variable declarations on separate line for each variable, with brief description on same line.
  8. Use the new and clearer syntax for LOGICAL comparisons, e.g. == instead of .EQ., > instead of .GT..
  9. Always use the optional space to separate Fortran keywords, e.g. end do instead of enddo, else if instead of elseif.
  10. Verify that your code follows the coding standard before submitting the merge request.

Thank you!