This is a list of the most commonly needed parts of the coding standards. For the complete coding standards click here
- 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).
- General formatting: use lower case throughout, indent blocks by 2 characters, try to confine your line width to 80 characters.
- Naming: use descriptive names for variables and procedures, avoid
_
except for specific uses (module prefix,_opt
and_r4
suffixes), usecamelCase
to differentiate words. - Layout: put all
use
statements at beginning of the module (not within procedures), avoid using theonly
statement, locate thepublic
statements near the top of the source file before everything else, procedure arguments should be declared before local variables. - Encapsulation: as much as possible avoid public module variables, locate variables and procedures in the module that maximizes encapsulation.
- For all new modules and procedures, include
! :Purpose:
for the automatically generated on-line documentation. Refer to the documentation page for more details. - All namelist variable declarations on separate line for each variable, with brief description on same line.
- Use the new and clearer syntax for
LOGICAL
comparisons, e.g.==
instead of.EQ.
,>
instead of.GT.
. - Always use the optional space to separate Fortran keywords, e.g.
end do
instead ofenddo
,else if
instead ofelseif
. - Verify that your code follows the coding standard before submitting the merge request.
Thank you!