Sebastian Jennen | f3a604e | 2020-04-16 12:48:42 +0200 | [diff] [blame] | 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 |
szb512 | 60b45a8 | 2020-07-13 11:58:09 -0400 | [diff] [blame^] | 4 | # change should be reviewed and only the appropriate ones commited. |
Sebastian Jennen | f3a604e | 2020-04-16 12:48:42 +0200 | [diff] [blame] | 5 | # |
Norbert Lange | 84cb270 | 2020-04-25 01:40:37 +0200 | [diff] [blame] | 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). |
Sebastian Jennen | f3a604e | 2020-04-16 12:48:42 +0200 | [diff] [blame] | 8 | # |
szb512 | 5b72b34 | 2020-07-09 09:23:32 -0400 | [diff] [blame] | 9 | # - Fix up formatting before committing |
Norbert Lange | 84cb270 | 2020-04-25 01:40:37 +0200 | [diff] [blame] | 10 | # 1. Edit and stage your files. |
| 11 | # 2. Run `git clang-format`. |
| 12 | # 3. Verify + correct + (un)stage changes. |
| 13 | # 4. Commit. |
| 14 | # |
szb512 | 5b72b34 | 2020-07-09 09:23:32 -0400 | [diff] [blame] | 15 | # - Fix up formatting after committing |
Norbert Lange | 84cb270 | 2020-04-25 01:40:37 +0200 | [diff] [blame] | 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: |
Sebastian Jennen | f3a604e | 2020-04-16 12:48:42 +0200 | [diff] [blame] | 22 | # $ git ls-files 'src/*.[ch]' 'src/*.cc' | xargs clang-format -i -style=file |
Norbert Lange | 84cb270 | 2020-04-25 01:40:37 +0200 | [diff] [blame] | 23 | # |
Sebastian Jennen | f3a604e | 2020-04-16 12:48:42 +0200 | [diff] [blame] | 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 | AlignEscapedNewlines: Left |
| 30 | AlignOperands: false |
| 31 | AllowShortFunctionsOnASingleLine: None |
| 32 | AlwaysBreakBeforeMultilineStrings: true |
| 33 | AlwaysBreakTemplateDeclarations: Yes |
| 34 | BinPackArguments: false |
| 35 | BinPackParameters: false |
| 36 | BraceWrapping: |
| 37 | AfterEnum: true |
| 38 | SplitEmptyFunction: false |
| 39 | SplitEmptyRecord: false |
| 40 | SplitEmptyNamespace: false |
| 41 | BreakBeforeBraces: Custom |
| 42 | BreakInheritanceList: BeforeComma |
| 43 | BreakBeforeTernaryOperators: false |
| 44 | BreakStringLiterals: false |
| 45 | ColumnLimit: 109 |
| 46 | CompactNamespaces: true |
| 47 | ConstructorInitializerAllOnOneLineOrOnePerLine: true |
| 48 | ConstructorInitializerIndentWidth: 8 |
| 49 | ContinuationIndentWidth: 8 |
| 50 | Cpp11BracedListStyle: false |
| 51 | ForEachMacros: |
| 52 | - BITMAP_FOREACH |
| 53 | - CMSG_FOREACH |
| 54 | - _DNS_ANSWER_FOREACH |
| 55 | - DNS_ANSWER_FOREACH |
| 56 | - _DNS_ANSWER_FOREACH_FLAGS |
| 57 | - DNS_ANSWER_FOREACH_FLAGS |
| 58 | - _DNS_ANSWER_FOREACH_FULL |
| 59 | - DNS_ANSWER_FOREACH_FULL |
| 60 | - _DNS_ANSWER_FOREACH_IFINDEX |
| 61 | - DNS_ANSWER_FOREACH_IFINDEX |
| 62 | - _DNS_QUESTION_FOREACH |
| 63 | - DNS_QUESTION_FOREACH |
| 64 | - FDSET_FOREACH |
| 65 | - FOREACH_BTRFS_IOCTL_SEARCH_HEADER |
| 66 | - FOREACH_DEVICE |
| 67 | - FOREACH_DEVICE_AND_SUBSYSTEM |
| 68 | - FOREACH_DEVICE_DEVLINK |
| 69 | - FOREACH_DEVICE_PROPERTY |
| 70 | - FOREACH_DEVICE_SYSATTR |
| 71 | - FOREACH_DEVICE_TAG |
| 72 | - FOREACH_DIRENT |
| 73 | - FOREACH_DIRENT_ALL |
| 74 | - FOREACH_INOTIFY_EVENT |
| 75 | - FOREACH_STRING |
| 76 | - FOREACH_SUBSYSTEM |
| 77 | - _FOREACH_WORD |
| 78 | - FOREACH_WORD |
| 79 | - FOREACH_WORD_SEPARATOR |
| 80 | - HASHMAP_FOREACH |
| 81 | - HASHMAP_FOREACH_IDX |
| 82 | - HASHMAP_FOREACH_KEY |
| 83 | - JOURNAL_FOREACH_DATA_RETVAL |
| 84 | - JSON_VARIANT_ARRAY_FOREACH |
| 85 | - JSON_VARIANT_OBJECT_FOREACH |
| 86 | - LIST_FOREACH |
| 87 | - LIST_FOREACH_AFTER |
| 88 | - LIST_FOREACH_BEFORE |
| 89 | - LIST_FOREACH_OTHERS |
| 90 | - LIST_FOREACH_SAFE |
| 91 | - MESSAGE_FOREACH_PART |
| 92 | - NULSTR_FOREACH |
| 93 | - NULSTR_FOREACH_PAIR |
| 94 | - OBJECT_PATH_FOREACH_PREFIX |
| 95 | - ORDERED_HASHMAP_FOREACH |
| 96 | - ORDERED_HASHMAP_FOREACH_KEY |
| 97 | - ORDERED_SET_FOREACH |
| 98 | - PATH_FOREACH_PREFIX |
| 99 | - PATH_FOREACH_PREFIX_MORE |
| 100 | - SD_HWDB_FOREACH_PROPERTY |
| 101 | - SD_JOURNAL_FOREACH |
| 102 | - SD_JOURNAL_FOREACH_BACKWARDS |
| 103 | - SD_JOURNAL_FOREACH_DATA |
| 104 | - SD_JOURNAL_FOREACH_FIELD |
| 105 | - SD_JOURNAL_FOREACH_UNIQUE |
| 106 | - SECCOMP_FOREACH_LOCAL_ARCH |
| 107 | - SET_FOREACH |
| 108 | - SET_FOREACH_MOVE |
| 109 | - STRV_FOREACH |
| 110 | - STRV_FOREACH_BACKWARDS |
| 111 | - STRV_FOREACH_PAIR |
| 112 | IndentPPDirectives: AfterHash |
| 113 | IndentWidth: 8 |
| 114 | IndentWrappedFunctionNames: true |
| 115 | MaxEmptyLinesToKeep: 2 |
| 116 | PenaltyBreakAssignment: 65 |
| 117 | PenaltyBreakBeforeFirstCallParameter: 16 |
| 118 | PenaltyBreakComment: 320 |
| 119 | PenaltyBreakFirstLessLess: 50 |
| 120 | PenaltyBreakString: 0 |
| 121 | PenaltyExcessCharacter: 10 |
| 122 | PenaltyReturnTypeOnItsOwnLine: 100 |
| 123 | SpaceAfterCStyleCast: true |
| 124 | SpacesInAngles: true |
| 125 | TabWidth: 8 |
| 126 | UseCRLF: false |