... | @@ -271,9 +271,8 @@ Important rules, and notable differences are summarized here: |
... | @@ -271,9 +271,8 @@ Important rules, and notable differences are summarized here: |
|
|
|
|
|
|
|
|
|
## General Rules
|
|
## General Rules
|
|
- Don't use ```using namespace ;``` or ```using symbol``` in a header file to inject alien definitions into the "corsika::" namespace (if not absolutely and fundamentally necessary). Do this only inside local scope, e.g. functions.
|
|
|
|
- Only include headers that you need. If you remove functionality, also remove header files! Include header files as local as possible.
|
|
- Basically never use "iostream" cout, cerr, and endl. We use our own logging machinery based on spdlog.
|
|
- Basically never use "iostream" cout, cerr, and endl. We use our own logging machinery based on spdlog!
|
|
|
|
- Test your code with ```-pedantic``` compiler flag enabled.
|
|
- Test your code with ```-pedantic``` compiler flag enabled.
|
|
- Warnings have to be fixed, when they appear on the system(s) currently used by the CI, by altering the code unless the warning originates from third-party code and cannot be fixed. In such cases, developers of the third-party project should be informed. Should the warning be locally silenced, either using appropriate pragmas or locally turning off warnings for that translation unit, documentation should be added in the entry point triggering the
|
|
- Warnings have to be fixed, when they appear on the system(s) currently used by the CI, by altering the code unless the warning originates from third-party code and cannot be fixed. In such cases, developers of the third-party project should be informed. Should the warning be locally silenced, either using appropriate pragmas or locally turning off warnings for that translation unit, documentation should be added in the entry point triggering the
|
|
warning using the flag ```"FIXME"``` as keyword.
|
|
warning using the flag ```"FIXME"``` as keyword.
|
... | @@ -331,26 +330,29 @@ warning using the flag ```"FIXME"``` as keyword. |
... | @@ -331,26 +330,29 @@ warning using the flag ```"FIXME"``` as keyword. |
|
- C header files ends with ".h" and source files with ".c"
|
|
- C header files ends with ".h" and source files with ".c"
|
|
|
|
|
|
|
|
|
|
## CMAKE formatting
|
|
## CMake formatting
|
|
|
|
|
|
- command are lower cases, e.g. ```set (...)```
|
|
Look at existing CMake file to get an impression on the style we use.
|
|
- variables upper case, e.g. ```set (VAR1 Text)```
|
|
|
|
|
|
- command are lower cases, e.g. ```set (...)```
|
|
Since cmake itself lacks structure almost entirely:
|
|
- variables upper case, e.g. ```set (VAR1 Text)```
|
|
- put a space between command and start of parenthesis, e.g. ```command (...)```
|
|
|
|
- add two spaces for logical indent
|
|
Since CMake itself lacks structure almost entirely:
|
|
```
|
|
|
|
if (condition)
|
|
- put a space between command and start of parenthesis, e.g. ```command (...)```
|
|
do something
|
|
- add two spaces for logical indent
|
|
endif (condition)
|
|
```
|
|
```
|
|
if (condition)
|
|
- break long lines to start with new keyword in new line (indented)
|
|
do something
|
|
```
|
|
endif (condition)
|
|
install (
|
|
```
|
|
FILES ${CORSIKAstackinterface_HEADERS}
|
|
- break long lines to start with new keyword in new line (indented)
|
|
DESTINATION include/${CORSIKAstackinterface_NAMESPACE}
|
|
```
|
|
)
|
|
install (
|
|
```
|
|
FILES ${CORSIKAstackinterface_HEADERS}
|
|
- add plenty of comments to all cmake code
|
|
DESTINATION include/${CORSIKAstackinterface_NAMESPACE}
|
|
- use expressive variables and functions
|
|
)
|
|
|
|
```
|
|
|
|
- add plenty of comments to all CMake code
|
|
|
|
- use expressive variables and functions
|
|
|
|
|