Skip to content

Instantly share code, notes, and snippets.

@ardabbour
Created June 9, 2021 21:04
Show Gist options
  • Save ardabbour/06f7d926d6a7f75259e08f569046563b to your computer and use it in GitHub Desktop.
Save ardabbour/06f7d926d6a7f75259e08f569046563b to your computer and use it in GitHub Desktop.
Clang Format configuration for ROS projects, from MoveIt!'s repository
BasedOnStyle: Google
ColumnLimit: 120
MaxEmptyLinesToKeep: 1
SortIncludes: true
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
NamespaceIndentation: None
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: false
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
ExperimentalAutoDetectBinPacking: false
ObjCSpaceBeforeProtocolList: true
Cpp11BracedListStyle: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BinPackParameters: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
PenaltyExcessCharacter: 1000
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakFirstLessLess: 1000
PenaltyBreakString: 100
PenaltyReturnTypeOnItsOwnLine: 70
SpacesBeforeTrailingComments: 2
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom
# Control of individual brace wrapping cases
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment