1 --- 2 # Typical usage is to apply this to the lines you've modified in a local 3 # change. Stage your changes with "git add" and then run: 4 # $ git clang-format 5 # You can optionally use the "--" file filter to restrict formatting to certain 6 # files or directories. The tool will display the list of files that were 7 # modified. These have been modified without being staged. You can review the 8 # modifications using "git diff". 9 # 10 # IF YOU UPDATE THE CPP SECTION ALSO UPDATE THE OBJECTIVE-C SECTION. IF YOU 11 # KNOW HOW TO SHARE SETTINGS BETWEEN THE TWO YOU'RE A TRUE HERO. 12 13 Language: Cpp 14 # BasedOnStyle: Google 15 AccessModifierOffset: -4 16 AlignAfterOpenBracket: Align 17 AlignConsecutiveAssignments: false 18 AlignConsecutiveDeclarations: false 19 AlignEscapedNewlinesLeft: true 20 AlignOperands: true 21 AlignTrailingComments: true 22 AllowAllParametersOfDeclarationOnNextLine: true 23 AllowShortBlocksOnASingleLine: false 24 AllowShortCaseLabelsOnASingleLine: false 25 AllowShortFunctionsOnASingleLine: All 26 AllowShortIfStatementsOnASingleLine: true 27 AllowShortLoopsOnASingleLine: true 28 AlwaysBreakAfterDefinitionReturnType: None 29 AlwaysBreakAfterReturnType: None 30 AlwaysBreakBeforeMultilineStrings: true 31 AlwaysBreakTemplateDeclarations: false 32 BinPackArguments: true 33 BinPackParameters: true 34 BraceWrapping: 35 AfterClass: false 36 AfterControlStatement: false 37 AfterEnum: false 38 AfterFunction: false 39 AfterNamespace: false 40 AfterObjCDeclaration: false 41 AfterStruct: false 42 AfterUnion: false 43 BeforeCatch: false 44 BeforeElse: false 45 IndentBraces: false 46 BreakBeforeBinaryOperators: None 47 BreakBeforeBraces: Custom 48 BreakBeforeTernaryOperators: true 49 BreakConstructorInitializersBeforeComma: true 50 BreakAfterJavaFieldAnnotations: false 51 BreakStringLiterals: true 52 ColumnLimit: 100 53 CommentPragmas: '^ IWYU pragma:' 54 ConstructorInitializerAllOnOneLineOrOnePerLine: true 55 ConstructorInitializerIndentWidth: 8 56 ContinuationIndentWidth: 8 57 Cpp11BracedListStyle: true 58 DerivePointerAlignment: false 59 DisableFormat: false 60 ExperimentalAutoDetectBinPacking: true 61 ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] 62 IncludeCategories: 63 - Regex: '^<.*\.h>' 64 Priority: 1 65 - Regex: '^<.*' 66 Priority: 2 67 - Regex: '.*' 68 Priority: 3 69 IncludeIsMainRegex: '([-_](test|unittest))?$' 70 IndentCaseLabels: true 71 IndentWidth: 4 72 IndentWrappedFunctionNames: false 73 JavaScriptQuotes: Leave 74 JavaScriptWrapImports: true 75 KeepEmptyLinesAtTheStartOfBlocks: false 76 MaxEmptyLinesToKeep: 1 77 NamespaceIndentation: None 78 ObjCBlockIndentWidth: 2 79 ObjCSpaceAfterProperty: false 80 ObjCSpaceBeforeProtocolList: false 81 PenaltyBreakBeforeFirstCallParameter: 1 82 PenaltyBreakComment: 300 83 PenaltyBreakFirstLessLess: 120 84 PenaltyBreakString: 1000 85 PenaltyExcessCharacter: 1000000 86 PenaltyReturnTypeOnItsOwnLine: 200 87 PointerAlignment: Left 88 ReflowComments: true 89 SortIncludes: true 90 SpaceAfterCStyleCast: false 91 SpaceAfterTemplateKeyword: true 92 SpaceBeforeAssignmentOperators: true 93 SpaceBeforeParens: ControlStatements 94 SpaceInEmptyParentheses: false 95 SpacesBeforeTrailingComments: 2 96 SpacesInAngles: false 97 SpacesInContainerLiterals: true 98 SpacesInCStyleCastParentheses: false 99 SpacesInParentheses: false 100 SpacesInSquareBrackets: false 101 Standard: Auto 102 TabWidth: 4 103 UseTab: Never 104 --- 105 Language: ObjC 106 AccessModifierOffset: -4 107 AlignAfterOpenBracket: Align 108 AlignConsecutiveAssignments: false 109 AlignConsecutiveDeclarations: false 110 AlignEscapedNewlinesLeft: true 111 AlignOperands: true 112 AlignTrailingComments: true 113 AllowAllParametersOfDeclarationOnNextLine: true 114 AllowShortBlocksOnASingleLine: false 115 AllowShortCaseLabelsOnASingleLine: false 116 AllowShortFunctionsOnASingleLine: All 117 AllowShortIfStatementsOnASingleLine: true 118 AllowShortLoopsOnASingleLine: true 119 AlwaysBreakAfterDefinitionReturnType: None 120 AlwaysBreakAfterReturnType: None 121 AlwaysBreakBeforeMultilineStrings: true 122 AlwaysBreakTemplateDeclarations: false 123 BinPackArguments: true 124 BinPackParameters: true 125 BraceWrapping: 126 AfterClass: false 127 AfterControlStatement: false 128 AfterEnum: false 129 AfterFunction: false 130 AfterNamespace: false 131 AfterObjCDeclaration: false 132 AfterStruct: false 133 AfterUnion: false 134 BeforeCatch: false 135 BeforeElse: false 136 IndentBraces: false 137 BreakBeforeBinaryOperators: None 138 BreakBeforeBraces: Custom 139 BreakBeforeTernaryOperators: true 140 BreakConstructorInitializersBeforeComma: true 141 BreakAfterJavaFieldAnnotations: false 142 BreakStringLiterals: true 143 ColumnLimit: 100 144 CommentPragmas: '^ IWYU pragma:' 145 ConstructorInitializerAllOnOneLineOrOnePerLine: true 146 ConstructorInitializerIndentWidth: 8 147 ContinuationIndentWidth: 8 148 Cpp11BracedListStyle: true 149 DerivePointerAlignment: false 150 DisableFormat: false 151 ExperimentalAutoDetectBinPacking: true 152 ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] 153 IncludeCategories: 154 - Regex: '^<.*\.h>' 155 Priority: 1 156 - Regex: '^<.*' 157 Priority: 2 158 - Regex: '.*' 159 Priority: 3 160 IncludeIsMainRegex: '([-_](test|unittest))?$' 161 IndentCaseLabels: true 162 IndentWidth: 4 163 IndentWrappedFunctionNames: false 164 JavaScriptQuotes: Leave 165 JavaScriptWrapImports: true 166 KeepEmptyLinesAtTheStartOfBlocks: false 167 MaxEmptyLinesToKeep: 1 168 NamespaceIndentation: None 169 ObjCBlockIndentWidth: 2 170 ObjCSpaceAfterProperty: false 171 ObjCSpaceBeforeProtocolList: false 172 PenaltyBreakBeforeFirstCallParameter: 1 173 PenaltyBreakComment: 300 174 PenaltyBreakFirstLessLess: 120 175 PenaltyBreakString: 1000 176 PenaltyExcessCharacter: 1000000 177 PenaltyReturnTypeOnItsOwnLine: 200 178 PointerAlignment: Left 179 ReflowComments: true 180 SortIncludes: true 181 SpaceAfterCStyleCast: false 182 SpaceAfterTemplateKeyword: true 183 SpaceBeforeAssignmentOperators: true 184 SpaceBeforeParens: ControlStatements 185 SpaceInEmptyParentheses: false 186 SpacesBeforeTrailingComments: 2 187 SpacesInAngles: false 188 SpacesInContainerLiterals: true 189 SpacesInCStyleCastParentheses: false 190 SpacesInParentheses: false 191 SpacesInSquareBrackets: false 192 Standard: Auto 193 TabWidth: 4 194 UseTab: Never 195 ... 196 197