Last active
June 4, 2025 19:18
-
-
Save ericjeker/6603f32003a4fa916d187be477e4a855 to your computer and use it in GitHub Desktop.
Clang Format for SFML Projects Inspired by Epic Games C++ Coding Standard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by Epic Games C++ Coding Standard | |
# Based on https://dev.epicgames.com/documentation/en-us/unreal-engine/epic-cplusplus-coding-standard-for-unreal-engine | |
Language: Cpp | |
Standard: c++17 | |
# Indentation | |
IndentWidth: 4 | |
TabWidth: 4 | |
UseTab: Always | |
IndentCaseLabels: true | |
IndentCaseBlocks: false | |
IndentGotoLabels: false | |
IndentPPDirectives: None | |
IndentExternBlock: NoIndent | |
IndentWrappedFunctionNames: false | |
NamespaceIndentation: None | |
# Alignment | |
AlignAfterOpenBracket: Align | |
AlignArrayOfStructures: Left | |
AlignConsecutiveAssignments: false | |
AlignConsecutiveBitFields: false | |
AlignConsecutiveDeclarations: false | |
AlignConsecutiveMacros: false | |
AlignEscapedNewlines: Left | |
AlignOperands: Align | |
AlignTrailingComments: true | |
# Line Breaking | |
ColumnLimit: 120 | |
AllowAllArgumentsOnNextLine: true | |
AllowAllParametersOfDeclarationOnNextLine: true | |
AllowShortBlocksOnASingleLine: Never | |
AllowShortCaseLabelsOnASingleLine: false | |
AllowShortEnumsOnASingleLine: false | |
AllowShortFunctionsOnASingleLine: None | |
AllowShortIfStatementsOnASingleLine: Never | |
AllowShortLambdasOnASingleLine: All | |
AllowShortLoopsOnASingleLine: false | |
AlwaysBreakAfterReturnType: None | |
AlwaysBreakBeforeMultilineStrings: false | |
AlwaysBreakTemplateDeclarations: Yes | |
BinPackArguments: true | |
BinPackParameters: true | |
BreakBeforeBinaryOperators: None | |
BreakBeforeBraces: Allman | |
BreakBeforeConceptDeclarations: true | |
BreakBeforeTernaryOperators: true | |
BreakConstructorInitializers: BeforeComma | |
BreakInheritanceList: BeforeComma | |
BreakStringLiterals: true | |
# Braces | |
BraceWrapping: | |
AfterCaseLabel: true | |
AfterClass: true | |
AfterControlStatement: Always | |
AfterEnum: true | |
AfterFunction: true | |
AfterNamespace: true | |
AfterStruct: true | |
AfterUnion: true | |
AfterExternBlock: true | |
BeforeCatch: true | |
BeforeElse: true | |
BeforeLambdaBody: false | |
BeforeWhile: false | |
IndentBraces: false | |
SplitEmptyFunction: true | |
SplitEmptyRecord: true | |
SplitEmptyNamespace: true | |
# Spaces | |
SpaceAfterCStyleCast: false | |
SpaceAfterLogicalNot: false | |
SpaceAfterTemplateKeyword: true | |
SpaceAroundPointerQualifiers: Default | |
SpaceBeforeAssignmentOperators: true | |
SpaceBeforeCaseColon: false | |
SpaceBeforeCpp11BracedList: false | |
SpaceBeforeCtorInitializerColon: true | |
SpaceBeforeInheritanceColon: true | |
SpaceBeforeParens: ControlStatements | |
SpaceBeforeRangeBasedForLoopColon: true | |
SpaceBeforeSquareBrackets: false | |
SpaceInEmptyBlock: false | |
SpaceInEmptyParentheses: false | |
SpacesBeforeTrailingComments: 1 | |
SpacesInAngles: Never | |
SpacesInCStyleCastParentheses: false | |
SpacesInConditionalStatement: false | |
SpacesInContainerLiterals: false | |
SpacesInParentheses: false | |
SpacesInSquareBrackets: false | |
# Includes | |
SortIncludes: CaseInsensitive | |
IncludeBlocks: Regroup | |
IncludeCategories: | |
# 1. Module's Public and Classes directories | |
- Regex: '^"[^/]+\.h"' | |
Priority: 1 | |
# 2. Other modules' Public directories | |
- Regex: '^".*/.*\.h"' | |
Priority: 2 | |
# 3. SFML headers | |
- Regex: '^<(SFML)/.*\.(h|hpp)>' | |
Priority: 3 | |
# 4. Platform headers | |
- Regex: '^<(Windows|Mac|Linux|IOS|Android).*\.h>' | |
Priority: 4 | |
# 5. Standard library headers | |
- Regex: '^<.*>' | |
Priority: 5 | |
# Other formatting options | |
AccessModifierOffset: -4 | |
CompactNamespaces: false | |
ConstructorInitializerIndentWidth: 4 | |
ContinuationIndentWidth: 4 | |
Cpp11BracedListStyle: true | |
DerivePointerAlignment: false | |
DisableFormat: false | |
EmptyLineAfterAccessModifier: Never | |
EmptyLineBeforeAccessModifier: LogicalBlock | |
FixNamespaceComments: true | |
InsertTrailingCommas: None | |
KeepEmptyLinesAtTheStartOfBlocks: false | |
MaxEmptyLinesToKeep: 2 | |
PointerAlignment: Left | |
SeparateDefinitionBlocks: Leave | |
# Penalties (for line-breaking decisions) | |
PenaltyBreakAssignment: 2 | |
PenaltyBreakBeforeFirstCallParameter: 19 | |
PenaltyBreakComment: 300 | |
PenaltyBreakFirstLessLess: 120 | |
PenaltyBreakString: 1000 | |
PenaltyBreakTemplateDeclaration: 10 | |
PenaltyExcessCharacter: 1000000 | |
PenaltyIndentedWhitespace: 0 | |
PenaltyReturnTypeOnItsOwnLine: 60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment