|
| 1 | +# QGroundControl C++ Code Formatting |
| 2 | +# Based on Google style with QGC customizations |
| 3 | +# Matches CodingStyle.cc/h patterns |
| 4 | + |
1 | 5 | BasedOnStyle: Google |
| 6 | +Language: Cpp |
| 7 | + |
| 8 | +# Line length and indentation |
2 | 9 | ColumnLimit: 120 |
3 | 10 | IndentWidth: 4 |
| 11 | +TabWidth: 4 |
| 12 | +UseTab: Never |
| 13 | +ContinuationIndentWidth: 4 |
| 14 | + |
| 15 | +# Bracing - Allman style (opening brace on new line) |
| 16 | +BreakBeforeBraces: Allman |
| 17 | +AllowShortFunctionsOnASingleLine: None |
| 18 | +AllowShortIfStatementsOnASingleLine: Never |
| 19 | +AllowShortLoopsOnASingleLine: false |
| 20 | +AllowShortBlocksOnASingleLine: Never |
| 21 | +AllowShortCaseLabelsOnASingleLine: false |
| 22 | + |
| 23 | +# Pointer and reference alignment |
| 24 | +PointerAlignment: Left |
| 25 | +ReferenceAlignment: Left |
| 26 | +DerivePointerAlignment: false |
| 27 | + |
| 28 | +# Spacing |
| 29 | +SpaceAfterCStyleCast: false |
| 30 | +SpaceAfterLogicalNot: false |
| 31 | +SpaceBeforeAssignmentOperators: true |
| 32 | +SpaceBeforeParens: ControlStatements |
| 33 | +SpaceInEmptyParentheses: false |
| 34 | +SpacesInAngles: Never |
| 35 | +SpacesInCStyleCastParentheses: false |
| 36 | +SpacesInParentheses: false |
| 37 | +SpacesInSquareBrackets: false |
| 38 | + |
| 39 | +# Include sorting |
| 40 | +SortIncludes: CaseSensitive |
| 41 | +IncludeBlocks: Regroup |
| 42 | +IncludeCategories: |
| 43 | + - Regex: '^<Q.*>' # Qt headers |
| 44 | + Priority: 1 |
| 45 | + - Regex: '^<.*>' # System/STL headers |
| 46 | + Priority: 2 |
| 47 | + - Regex: '.*' # Project headers |
| 48 | + Priority: 3 |
| 49 | + |
| 50 | +# Alignment |
| 51 | +AlignAfterOpenBracket: Align |
| 52 | +AlignConsecutiveAssignments: None |
| 53 | +AlignConsecutiveDeclarations: None |
| 54 | +AlignOperands: Align |
| 55 | +AlignTrailingComments: |
| 56 | + Kind: Always |
| 57 | + OverEmptyLines: 1 |
| 58 | + |
| 59 | +# Line breaks |
| 60 | +AlwaysBreakAfterReturnType: None |
| 61 | +AlwaysBreakTemplateDeclarations: Yes |
| 62 | +BreakBeforeBinaryOperators: None |
| 63 | +BreakBeforeTernaryOperators: true |
| 64 | +BreakConstructorInitializers: BeforeColon |
| 65 | +BreakInheritanceList: BeforeColon |
| 66 | +ConstructorInitializerIndentWidth: 4 |
| 67 | + |
| 68 | +# Namespace formatting |
| 69 | +CompactNamespaces: false |
| 70 | +NamespaceIndentation: None |
| 71 | + |
| 72 | +# Other formatting |
| 73 | +BinPackArguments: true |
| 74 | +BinPackParameters: true |
| 75 | +KeepEmptyLinesAtTheStartOfBlocks: false |
| 76 | +MaxEmptyLinesToKeep: 1 |
| 77 | +ReflowComments: true |
| 78 | +Standard: c++20 |
0 commit comments