dev:formattingconventions
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| dev:formattingconventions [2016/03/16 13:34] – Changed title pseewald | dev:formattingconventions [2020/08/21 10:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Code Formatting Conventions and Prettify Tool ====== | ====== Code Formatting Conventions and Prettify Tool ====== | ||
| - | Uniform formatting of CP2K source code will be enabled | + | Uniform formatting of CP2K source code is enabled by a prettify script that is an almost complete auto-formatter for Fortran 90 source code. As a rule of thumb, developers should not worry about the format of their code and just let prettify do its magic by running '' |
| + | ===== Formatting conventions ===== | ||
| + | The following | ||
| * Sorting and alignment of variable declarations and '' | * Sorting and alignment of variable declarations and '' | ||
| * Indentation with a relative width of 3 characters. | * Indentation with a relative width of 3 characters. | ||
| Line 7: | Line 9: | ||
| * Removal of extraneous whitespace and consecutive blank lines. | * Removal of extraneous whitespace and consecutive blank lines. | ||
| * Uppercase notation for all Fortran and OpenMP keywords. | * Uppercase notation for all Fortran and OpenMP keywords. | ||
| + | |||
| + | ===== Manual formatting ===== | ||
| The following formatting decisions are still manual and are never changed by prettify: | The following formatting decisions are still manual and are never changed by prettify: | ||
| * Positions of line breaks (except for variable declarations and '' | * Positions of line breaks (except for variable declarations and '' | ||
| * No indentation of subsequent '' | * No indentation of subsequent '' | ||
| - | There may be cases where manual alignment is preferred over the rules stated above. The following options for manual formatting are provided: | + | There may be cases where manual alignment is preferred over the automatic formatting conventions. The following options for manual formatting are provided: |
| * No automatic realignment of line continuations that are prefixed with an ''&'' | * No automatic realignment of line continuations that are prefixed with an ''&'' | ||
| * No auto-formatting of lines to which a comment starting with '' | * No auto-formatting of lines to which a comment starting with '' | ||
| * No auto-formatting of code blocks enclosed between two comment lines starting with '' | * No auto-formatting of code blocks enclosed between two comment lines starting with '' | ||
| + | ===== Examples ===== | ||
| A few examples to illustrate how to deal with cases where auto-formatting produces unsatisfying results: | A few examples to illustrate how to deal with cases where auto-formatting produces unsatisfying results: | ||
dev/formattingconventions.1458135299.txt.gz · Last modified: (external edit)
