| 1 |
# This configuration file can be used to auto-format the code base. |
| 2 |
# Not all guidelines specified in CODING_STYLE are followed, so the |
| 3 |
# result MUST NOT be committed indiscriminately, but each automated |
| 4 |
# change should be reviewed and only the appropriate ones committed. |
| 5 |
# |
| 6 |
# The easiest way to apply the formatting to your changes ONLY, |
| 7 |
# is to use the git-clang-format script (usually installed with clang-format). |
| 8 |
# |
| 9 |
# - Fix up formatting before committing |
| 10 |
# 1. Edit and stage your files. |
| 11 |
# 2. Run `git clang-format`. |
| 12 |
# 3. Verify + correct + (un)stage changes. |
| 13 |
# 4. Commit. |
| 14 |
# |
| 15 |
# - Fix up formatting after committing |
| 16 |
# 1. Commit your changes. |
| 17 |
# 2. Run `git clang-format HEAD~` - Refer the commit *before* your changes here. |
| 18 |
# 3. Verify + correct changes, `git difftool -d` can help here. |
| 19 |
# 4. Stage + commit, potentially with `--amend` (means to fixup the last commit). |
| 20 |
# |
| 21 |
# To run clang-format on all sourcefiles, use the following line: |
| 22 |
# $ git ls-files 'src/*.[ch]' 'src/*.cc' | xargs clang-format -i -style=file |
| 23 |
# |
| 24 |
# You can find more information on the different config parameters in this file here: |
| 25 |
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html |
| 26 |
--- |
| 27 |
AccessModifierOffset: -4 |
| 28 |
AlignAfterOpenBracket: AlwaysBreak |
| 29 |
AlignArrayOfStructures: Right |
| 30 |
AlignEscapedNewlines: Left |
| 31 |
AlignOperands: false |
| 32 |
AllowShortFunctionsOnASingleLine: None |
| 33 |
AlwaysBreakBeforeMultilineStrings: true |
| 34 |
AlwaysBreakTemplateDeclarations: Yes |
| 35 |
BinPackArguments: false |
| 36 |
BinPackParameters: false |
| 37 |
BraceWrapping: |
| 38 |
AfterEnum: false |
| 39 |
SplitEmptyFunction: false |
| 40 |
SplitEmptyRecord: false |
| 41 |
SplitEmptyNamespace: false |
| 42 |
BreakBeforeBraces: Custom |
| 43 |
BreakBeforeTernaryOperators: false |
| 44 |
BreakInheritanceList: BeforeComma |
| 45 |
BreakStringLiterals: false |
| 46 |
ColumnLimit: 109 |
| 47 |
CompactNamespaces: true |
| 48 |
ConstructorInitializerAllOnOneLineOrOnePerLine: true |
| 49 |
ConstructorInitializerIndentWidth: 8 |
| 50 |
ContinuationIndentWidth: 16 |
| 51 |
Cpp11BracedListStyle: false |
| 52 |
ForEachMacros: |
| 53 |
- BITMAP_FOREACH |
| 54 |
- CMSG_FOREACH |
| 55 |
- _DNS_ANSWER_FOREACH |
| 56 |
- DNS_ANSWER_FOREACH |
| 57 |
- _DNS_ANSWER_FOREACH_FLAGS |
| 58 |
- DNS_ANSWER_FOREACH_FLAGS |
| 59 |
- _DNS_ANSWER_FOREACH_FULL |
| 60 |
- DNS_ANSWER_FOREACH_FULL |
| 61 |
- _DNS_ANSWER_FOREACH_IFINDEX |
| 62 |
- DNS_ANSWER_FOREACH_IFINDEX |
| 63 |
- _DNS_QUESTION_FOREACH |
| 64 |
- DNS_QUESTION_FOREACH |
| 65 |
- FDSET_FOREACH |
| 66 |
- FOREACH_BTRFS_IOCTL_SEARCH_HEADER |
| 67 |
- FOREACH_DEVICE |
| 68 |
- FOREACH_DEVICE_AND_SUBSYSTEM |
| 69 |
- FOREACH_DEVICE_DEVLINK |
| 70 |
- FOREACH_DEVICE_PROPERTY |
| 71 |
- FOREACH_DEVICE_SYSATTR |
| 72 |
- FOREACH_DEVICE_TAG |
| 73 |
- FOREACH_DIRENT |
| 74 |
- FOREACH_DIRENT_ALL |
| 75 |
- FOREACH_INOTIFY_EVENT |
| 76 |
- FOREACH_STRING |
| 77 |
- FOREACH_SUBSYSTEM |
| 78 |
- HASHMAP_FOREACH |
| 79 |
- HASHMAP_FOREACH_IDX |
| 80 |
- HASHMAP_FOREACH_KEY |
| 81 |
- JOURNAL_FOREACH_DATA_RETVAL |
| 82 |
- JSON_VARIANT_ARRAY_FOREACH |
| 83 |
- JSON_VARIANT_OBJECT_FOREACH |
| 84 |
- LIST_FOREACH |
| 85 |
- LIST_FOREACH_AFTER |
| 86 |
- LIST_FOREACH_BEFORE |
| 87 |
- LIST_FOREACH_OTHERS |
| 88 |
- LIST_FOREACH_SAFE |
| 89 |
- MESSAGE_FOREACH_PART |
| 90 |
- NULSTR_FOREACH |
| 91 |
- NULSTR_FOREACH_PAIR |
| 92 |
- OBJECT_PATH_FOREACH_PREFIX |
| 93 |
- ORDERED_HASHMAP_FOREACH |
| 94 |
- ORDERED_HASHMAP_FOREACH_KEY |
| 95 |
- ORDERED_SET_FOREACH |
| 96 |
- PATH_FOREACH_PREFIX |
| 97 |
- PATH_FOREACH_PREFIX_MORE |
| 98 |
- SD_HWDB_FOREACH_PROPERTY |
| 99 |
- SD_JOURNAL_FOREACH |
| 100 |
- SD_JOURNAL_FOREACH_BACKWARDS |
| 101 |
- SD_JOURNAL_FOREACH_DATA |
| 102 |
- SD_JOURNAL_FOREACH_FIELD |
| 103 |
- SD_JOURNAL_FOREACH_UNIQUE |
| 104 |
- SECCOMP_FOREACH_LOCAL_ARCH |
| 105 |
- SET_FOREACH |
| 106 |
- SET_FOREACH_MOVE |
| 107 |
- STRV_FOREACH |
| 108 |
- STRV_FOREACH_BACKWARDS |
| 109 |
- STRV_FOREACH_PAIR |
| 110 |
IncludeBlocks: Regroup |
| 111 |
IncludeCategories: |
| 112 |
# "vmlinux.h" must always be included first in BPF programs before anything else. |
| 113 |
- Regex: '^"vmlinux.h"$' |
| 114 |
Priority: 1 |
| 115 |
# <bpf/*.h> headers must be included after <linux/types.h> by design. |
| 116 |
- Regex: '^<bpf/.*\.h>$' |
| 117 |
Priority: 2 |
| 118 |
SortPriority: 3 |
| 119 |
- Regex: '^<.*\.h>$' |
| 120 |
Priority: 2 |
| 121 |
- Regex: '^"_?sd-.*\.h"$' |
| 122 |
Priority: 4 |
| 123 |
- Regex: '^"libudev\.h"$' |
| 124 |
Priority: 4 |
| 125 |
- Regex: '^"audit_type-to-name.h"$' |
| 126 |
Priority: 6 |
| 127 |
- Regex: '.*' |
| 128 |
Priority: 5 |
| 129 |
# Make sure the "main header" is not treated any differently than other headers. |
| 130 |
IncludeIsMainRegex: '^$' |
| 131 |
IndentPPDirectives: AfterHash |
| 132 |
IndentWidth: 8 |
| 133 |
IndentWrappedFunctionNames: true |
| 134 |
MaxEmptyLinesToKeep: 2 |
| 135 |
PenaltyBreakAssignment: 65 |
| 136 |
PenaltyBreakBeforeFirstCallParameter: 16 |
| 137 |
PenaltyBreakComment: 320 |
| 138 |
PenaltyBreakFirstLessLess: 50 |
| 139 |
PenaltyBreakString: 0 |
| 140 |
PenaltyExcessCharacter: 10 |
| 141 |
PenaltyReturnTypeOnItsOwnLine: 100 |
| 142 |
PointerAlignment: Right |
| 143 |
SpaceAfterCStyleCast: true |
| 144 |
SpaceAroundPointerQualifiers: Both |
| 145 |
SpaceBeforeParens: ControlStatementsExceptForEachMacros |
| 146 |
SpacesInAngles: true |
| 147 |
TabWidth: 8 |
| 148 |
UseCRLF: false |