Changeset View
Changeset View
Standalone View
Standalone View
.clang-format
- This file was added.
| 1 | --- | ||||
|---|---|---|---|---|---|
| 2 | # SPDX-License-Identifier: MIT | ||||
| 3 | # | ||||
| 4 | # Copyright (C) 2019 Christoph Cullmann <cullmann@kde.org> | ||||
| 5 | # Copyright (C) 2019 Vlad Zahorodnii <vladzzag@gmail.com> | ||||
| 6 | # Copyright (C) 2019 Gernot Gebhard <gebhard@absint.com> | ||||
| 7 | # | ||||
| 8 | # Permission is hereby granted, free of charge, to any person obtaining | ||||
| 9 | # a copy of this software and associated documentation files (the | ||||
| 10 | # "Software"), to deal in the Software without restriction, including | ||||
| 11 | # without limitation the rights to use, copy, modify, merge, publish, | ||||
| 12 | # distribute, sublicense, and/or sell copies of the Software, and to | ||||
| 13 | # permit persons to whom the Software is furnished to do so, subject to | ||||
| 14 | # the following conditions: | ||||
| 15 | # | ||||
| 16 | # The above copyright notice and this permission notice shall be included | ||||
| 17 | # in all copies or substantial portions of the Software. | ||||
| 18 | # | ||||
| 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||
| 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
| 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||||
| 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||||
| 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||||
| 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||||
| 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
| 26 | | ||||
| 27 | # Style for C++ | ||||
| 28 | Language: Cpp | ||||
| 29 | | ||||
| 30 | # base is WebKit coding style: http://www.webkit.org/coding/coding-style.html | ||||
| 31 | # below are only things set that diverge from this style! | ||||
| 32 | BasedOnStyle: WebKit | ||||
| 33 | | ||||
| 34 | # enforce C++11 (e.g. for std::vector<std::vector<lala>> | ||||
| 35 | Standard: Cpp11 | ||||
| 36 | | ||||
| 37 | # 4 spaces indent | ||||
| 38 | TabWidth: 4 | ||||
| 39 | | ||||
| 40 | # Don't format | ||||
| 41 | ColumnLimit: 0 | ||||
| 42 | | ||||
| 43 | SortIncludes: true | ||||
| 44 | IncludeBlocks: Preserve | ||||
| 45 | | ||||
| 46 | # break before braces on function, namespace and class definitions. | ||||
| 47 | BreakBeforeBraces: Linux | ||||
| 48 | | ||||
| 49 | # CrlInstruction *a; | ||||
| 50 | PointerAlignment: Right | ||||
| 51 | | ||||
| 52 | # horizontally aligns arguments after an open bracket. | ||||
| 53 | AlignAfterOpenBracket: Align | ||||
| 54 | | ||||
| 55 | # align trailing comments | ||||
| 56 | AlignTrailingComments: true | ||||
zzag: I'd object to aligning trailing comments because a single line change may affect many other… | |||||
| 57 | | ||||
| 58 | # don't move all parameters to new line | ||||
| 59 | AllowAllParametersOfDeclarationOnNextLine: false | ||||
| 60 | | ||||
| 61 | # no single line functions | ||||
| 62 | AllowShortFunctionsOnASingleLine: None | ||||
| 63 | | ||||
| 64 | # always break before you encounter multi line strings | ||||
| 65 | AlwaysBreakBeforeMultilineStrings: true | ||||
| 66 | | ||||
| 67 | # don't move arguments to own lines if they are not all on the same | ||||
| 68 | BinPackArguments: false | ||||
| 69 | | ||||
| 70 | # don't move parameters to own lines if they are not all on the same | ||||
| 71 | BinPackParameters: false | ||||
| 72 | | ||||
| 73 | # don't break binary ops | ||||
| 74 | BreakBeforeBinaryOperators: None | ||||
| 75 | | ||||
| 76 | # don't break tenary ops | ||||
| 77 | BreakBeforeTernaryOperators: false | ||||
| 78 | | ||||
| 79 | # format C++11 braced lists like function calls | ||||
| 80 | Cpp11BracedListStyle: true | ||||
| 81 | | ||||
| 82 | # indent case labels one level | ||||
| 83 | IndentCaseLabels: true | ||||
zzag: The Frameworks coding says not to indent case lables. | |||||
zzag: s/coding/coding style/ | |||||
Fixed that in D24568 cullmann: Fixed that in D24568 | |||||
| 84 | | ||||
| 85 | # remove empty lines | ||||
| 86 | KeepEmptyLinesAtTheStartOfBlocks: false | ||||
| 87 | | ||||
| 88 | # no namespace indentation to keep indent level low | ||||
| 89 | NamespaceIndentation: None | ||||
I'd object to aligning trailing comments because a single line change may affect many other unrelated lines.
However, if this .clang-format file serves just as a sample and projects are allowed to tweak it, then it's fine.