File: Formatting.md

package info (click to toggle)
jacktrip 1.7.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,728 kB
  • sloc: cpp: 31,952; sh: 794; makefile: 121; xml: 24; python: 15
file content (34 lines) | stat: -rw-r--r-- 841 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Formatting with clang-format

JackTrip uses clang-format to specify the Code Formatting Style.
Most IDEs are able to recognize the `.clang-format` file in JackTrip's project
directory and integrate the formatting capabilities.

Formatting specific files is done like this:

```bash
clang-format -i class.cpp class.h
```

This overrides all given files. If you only want to check the formatting `-i` has
to be removed.

Areas in the source code that must not be formatted have to be embraced in following statements:

```c++
this = is.formatted;
// clang-format off
this+=   isnot     ;
// clang-format on
this = again;
```

## Formatting the entire code base

Formatting the entire code base can be done with specifying all code files of the project
or be invoking Meson's clang-format target:

```bash
ninja -C builddir clang-format
```