YAC 3.13.0
Yet Another Coupler
Loading...
Searching...
No Matches
Style Guide

Introduction

This document defines the standard conventions used in code and documentation for this project to ensure consistency, readability, and maintainability.

General Formatting Rules

  • Limit all lines to a maximum of 80 characters.
  • Use 2 spaces for indentation.
  • Do not use tabs under any circumstances.
  • Do not allow trailing whitespace at the end of any line.
  • Text files should be ended with a newline.

General Coding Conventions

  • Use the prefix yac_ for exported symbols (yac_c for C, yac_f for Fortran).
    Example: yac_cinit().

C

  • Use snake_case per default (for naming variables, functions...).
  • (optional) Use CamelCase for names of types.
    Example: typedef struct struct_name MyStruct; MyStruct foo, bar;
  • (recommended) Use curly braces also for one-line for, if, etc.
  • Each file should include all necessary header files. (Exception: For header-source file pairs, the source file does not need to include the header’s includes again). This simplifies dependency tracking.

Fortran

  • Use lowercase for keywords such as subroutine, implicit none, etc.

Spelling Convention

  • The name of the software YAC is always written in all caps. Depending on the context, exceptions are allowed (e.g. conflicting coding conventions)
  • The name of the software yaxt is always written in lowercase. Depending on the context, exceptions are allowed (e.g. conflicting coding conventions)
  • Use British English (BE) throughout general code and documentation.
  • Use American English (AE) only for naming routines and symbols related to MPI, as MPI follows AE conventions.
  • For other commonly used terms (e.g. software packages) the spelling used on the respective documentation should be used. Another good reference is wikipedia. Here is a list (in alphabetical order) of terms that are used frequently: netCDF, OASIS, ParaView, Python, SCRIP

Capitalization

  • Titles of pages and sections etc. follow title case.