blob: 651249c701b4e63949034ed6aeabcb22faca3726 [file] [log] [blame]
Sebastian Jennenf3a604e2020-04-16 12:48:42 +02001# 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
szb51260b45a82020-07-13 11:58:09 -04004# change should be reviewed and only the appropriate ones commited.
Sebastian Jennenf3a604e2020-04-16 12:48:42 +02005#
Norbert Lange84cb2702020-04-25 01:40:37 +02006# 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 Jennenf3a604e2020-04-16 12:48:42 +02008#
szb5125b72b342020-07-09 09:23:32 -04009# - Fix up formatting before committing
Norbert Lange84cb2702020-04-25 01:40:37 +020010# 1. Edit and stage your files.
11# 2. Run `git clang-format`.
12# 3. Verify + correct + (un)stage changes.
13# 4. Commit.
14#
szb5125b72b342020-07-09 09:23:32 -040015# - Fix up formatting after committing
Norbert Lange84cb2702020-04-25 01:40:37 +020016# 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 Jennenf3a604e2020-04-16 12:48:42 +020022# $ git ls-files 'src/*.[ch]' 'src/*.cc' | xargs clang-format -i -style=file
Norbert Lange84cb2702020-04-25 01:40:37 +020023#
Sebastian Jennenf3a604e2020-04-16 12:48:42 +020024# You can find more information on the different config parameters in this file here:
25# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
26---
27AccessModifierOffset: -4
28AlignAfterOpenBracket: AlwaysBreak
29AlignEscapedNewlines: Left
30AlignOperands: false
31AllowShortFunctionsOnASingleLine: None
32AlwaysBreakBeforeMultilineStrings: true
33AlwaysBreakTemplateDeclarations: Yes
34BinPackArguments: false
35BinPackParameters: false
36BraceWrapping:
Norbert Langed3f45d12020-07-19 01:40:06 +020037 AfterEnum: false
Sebastian Jennenf3a604e2020-04-16 12:48:42 +020038 SplitEmptyFunction: false
39 SplitEmptyRecord: false
40 SplitEmptyNamespace: false
41BreakBeforeBraces: Custom
42BreakInheritanceList: BeforeComma
43BreakBeforeTernaryOperators: false
44BreakStringLiterals: false
45ColumnLimit: 109
46CompactNamespaces: true
47ConstructorInitializerAllOnOneLineOrOnePerLine: true
48ConstructorInitializerIndentWidth: 8
49ContinuationIndentWidth: 8
50Cpp11BracedListStyle: false
51ForEachMacros:
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
Sebastian Jennenf3a604e2020-04-16 12:48:42 +020077 - HASHMAP_FOREACH
78 - HASHMAP_FOREACH_IDX
79 - HASHMAP_FOREACH_KEY
80 - JOURNAL_FOREACH_DATA_RETVAL
81 - JSON_VARIANT_ARRAY_FOREACH
82 - JSON_VARIANT_OBJECT_FOREACH
83 - LIST_FOREACH
84 - LIST_FOREACH_AFTER
85 - LIST_FOREACH_BEFORE
86 - LIST_FOREACH_OTHERS
87 - LIST_FOREACH_SAFE
88 - MESSAGE_FOREACH_PART
89 - NULSTR_FOREACH
90 - NULSTR_FOREACH_PAIR
91 - OBJECT_PATH_FOREACH_PREFIX
92 - ORDERED_HASHMAP_FOREACH
93 - ORDERED_HASHMAP_FOREACH_KEY
94 - ORDERED_SET_FOREACH
95 - PATH_FOREACH_PREFIX
96 - PATH_FOREACH_PREFIX_MORE
97 - SD_HWDB_FOREACH_PROPERTY
98 - SD_JOURNAL_FOREACH
99 - SD_JOURNAL_FOREACH_BACKWARDS
100 - SD_JOURNAL_FOREACH_DATA
101 - SD_JOURNAL_FOREACH_FIELD
102 - SD_JOURNAL_FOREACH_UNIQUE
103 - SECCOMP_FOREACH_LOCAL_ARCH
104 - SET_FOREACH
105 - SET_FOREACH_MOVE
106 - STRV_FOREACH
107 - STRV_FOREACH_BACKWARDS
108 - STRV_FOREACH_PAIR
109IndentPPDirectives: AfterHash
110IndentWidth: 8
111IndentWrappedFunctionNames: true
112MaxEmptyLinesToKeep: 2
113PenaltyBreakAssignment: 65
114PenaltyBreakBeforeFirstCallParameter: 16
115PenaltyBreakComment: 320
116PenaltyBreakFirstLessLess: 50
117PenaltyBreakString: 0
118PenaltyExcessCharacter: 10
119PenaltyReturnTypeOnItsOwnLine: 100
120SpaceAfterCStyleCast: true
Daan De Meyer36046ce2020-11-16 00:11:50 +0000121SpaceBeforeParens: ControlStatementsExceptForEachMacros
Sebastian Jennenf3a604e2020-04-16 12:48:42 +0200122SpacesInAngles: true
123TabWidth: 8
124UseCRLF: false