-
Notifications
You must be signed in to change notification settings - Fork 12
Include clang-format document #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,209 @@ | ||
| TabWidth: 4 | ||
| IndentWidth: 4 | ||
| ColumnLimit: 80 | ||
|
|
||
| UseTab: AlignWithSpaces | ||
|
|
||
| # Pointer and reference alignment style. Possible values: Left, Right, Middle. | ||
| PointerAlignment: Right | ||
|
|
||
| # AccessModifierOffset (int) | ||
| # The extra indent or outdent of access modifiers, e.g. public:. | ||
| AccessModifierOffset: 0 | ||
|
|
||
| AlignArrayOfStructures: Right | ||
| AlignAfterOpenBracket: true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer AlwaysBreak. This is important to comment out parameters without having to worry if it is the first or last one. |
||
| AlignConsecutiveAssignments: Consecutive | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure how I feel about this.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When aesthetcs are at odds with ergonomics, ergonomics should win.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| AlignConsecutiveBitFields: Consecutive | ||
| AlignConsecutiveDeclarations: None | ||
| AlignConsecutiveMacros: Consecutive | ||
| AlignConsecutiveShortCaseStatements: | ||
| Enabled: true | ||
| AcrossEmptyLines: true | ||
| AcrossComments: true | ||
| AlignCaseColons: false | ||
|
|
||
|
|
||
| AlignEscapedNewlines: LeftWithLastLine | ||
|
|
||
| AlignOperands: Align | ||
|
|
||
| AlignTrailingComments: | ||
| Kind: Always | ||
| AlignPPAndNotPP: true | ||
|
|
||
| AllowAllArgumentsOnNextLine: true | ||
| AllowAllParametersOfDeclarationOnNextLine: true | ||
| AllowBreakBeforeNoexceptSpecifier: Always | ||
|
|
||
| AllowShortBlocksOnASingleLine: Always | ||
| AllowShortCaseExpressionOnASingleLine: true | ||
| AllowShortCaseLabelsOnASingleLine: true | ||
| AllowShortCompoundRequirementOnASingleLine: true | ||
| AllowShortEnumsOnASingleLine: false | ||
|
|
||
| AllowShortFunctionsOnASingleLine: Empty | ||
| AllowShortIfStatementsOnASingleLine: WithoutElse | ||
| AllowShortLambdasOnASingleLine: Inline | ||
| AllowShortLoopsOnASingleLine: true | ||
| AllowShortNamespacesOnASingleLine: false | ||
|
|
||
| AlwaysBreakBeforeMultilineStrings: false | ||
|
|
||
| BitFieldColonSpacing: Both | ||
|
|
||
| # TODO Highly Opinionated will need to deliberate on this. I prefer K&R Style but some prefer Allman | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While K&R does save space, I tend to find it harder to read and review than Allman. Not sure if we want to have a poll for this or not. But if the C++ team is already heavily leaning towards K&R then I wont really object.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I write code in Allman, but it isn't a hill I care to die on. |
||
| BreakBeforeBraces: Custom | ||
| BraceWrapping: | ||
| AfterCaseLabel: false | ||
| AfterClass: false | ||
| AfterControlStatement: Never | ||
| AfterEnum: false | ||
| AfterFunction: false | ||
| AfterNamespace: false | ||
| AfterStruct: false | ||
| AfterExternBlock: false | ||
| BeforeCatch: true # catch on separate line, not like we'll use catch | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for consistency. I'd also rather have K&R |
||
| BeforeElse: true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not having a break for if but having for else will look strange for me.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like if you set In my opinion that does make it a little harder to read especially if the last line before the else has a lot of values. |
||
| BeforeLambdaBody: false | ||
| BeforeWhile: true | ||
| IndentBraces: false | ||
|
|
||
| BreakAdjacentStringLiterals: false | ||
| BreakAfterAttributes: Leave | ||
|
|
||
| BreakAfterOpenBracketBracedList: false | ||
| BreakAfterOpenBracketFunction: false | ||
| BreakAfterOpenBracketIf: false | ||
| BreakAfterOpenBracketLoop: false | ||
| BreakAfterOpenBracketSwitch: false | ||
| BreakAfterReturnType: Automatic | ||
|
|
||
| BreakBeforeBinaryOperators: None | ||
| BreakBeforeCloseBracketBracedList: true | ||
| BreakBeforeCloseBracketFunction: true | ||
| BreakBeforeCloseBracketIf: true | ||
| BreakBeforeCloseBracketSwitch: true | ||
|
|
||
|
Comment on lines
+75
to
+87
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Look for clang-format version pinning in repo docs/CI =="
rg -n -S "clang-format|llvm|clang version|PackParameters|BinPackParameters" -g '!**/build/**'
echo
echo "== Show .clang-format lines around version-sensitive settings =="
nl -ba .clang-format | sed -n '70,95p;155,170p'Repository: Redot-Engine/DraconicEngine Length of output: 3135 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Search for clang-format pinning/version usage (CI/docs/scripts) =="
rg -n -S --hidden --glob '!.git/*' \
"clang-format[ -]?(1[5-9]|2[0-9]|[3-9][0-9])|clang-format\\b|LLVM_VERSION|clang version|PackParameters|BinPackParameters" \
.github .gitlab ci scripts tools docs . 2>/dev/null | head -n 200
echo
echo "== Show .clang-format lines 70-95 (with line numbers) =="
awk 'NR>=70 && NR<=95 {printf "%4d:%s\n", NR, $0}' .clang-format
echo
echo "== Show .clang-format lines 155-170 (with line numbers) =="
awk 'NR>=155 && NR<=170 {printf "%4d:%s\n", NR, $0}' .clang-formatRepository: Redot-Engine/DraconicEngine Length of output: 3186 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== .clang-format lines 70-95 =="
awk 'NR>=70 && NR<=95 {printf "%4d:%s\n", NR, $0}' .clang-format
echo
echo "== .clang-format lines 155-170 =="
awk 'NR>=155 && NR<=170 {printf "%4d:%s\n", NR, $0}' .clang-formatRepository: Redot-Engine/DraconicEngine Length of output: 1350 Pin and enforce a single clang-format version for this config. This 🤖 Prompt for AI Agents |
||
| BreakBeforeConceptDeclarations: Allowed | ||
| BreakBeforeInlineASMColon: OnlyMultiline | ||
| BreakBeforeTemplateCloser: true | ||
| BreakBeforeTernaryOperators: true | ||
|
|
||
| BreakConstructorInitializers: AfterColon | ||
| BreakFunctionDefinitionParameters: false | ||
|
|
||
| BreakInheritanceList: AfterColon | ||
|
|
||
| BreakStringLiterals: false | ||
|
|
||
| BreakTemplateDeclarations: Leave | ||
|
|
||
| CompactNamespaces: false | ||
|
|
||
| Cpp11BracedListStyle: FunctionCall | ||
|
|
||
| EmptyLineAfterAccessModifier: Leave | ||
| EmptyLineBeforeAccessModifier: LogicalBlock | ||
|
|
||
| EnumTrailingComma: Leave | ||
|
|
||
| FixNamespaceComments: true | ||
|
|
||
| IndentAccessModifiers: false | ||
|
|
||
| IndentCaseBlocks: false | ||
|
|
||
| IndentExportBlock: false | ||
| IndentExternBlock: false | ||
| IndentGotoLabels: true | ||
|
|
||
| IndentPPDirectives: BeforeHash | ||
| IndentRequiresClause: false | ||
| IndentWrappedFunctionNames: false | ||
|
|
||
| # I personally don't like unbraced things but this should be heavily discussed | ||
| # For example it's a Pain in the ass to go back and add braces when someone | ||
| # didn't include them after you need to extend it | ||
| InsertBraces: true | ||
|
|
||
| InsertNewlineAtEOF: true | ||
|
|
||
| # This one will be controversial... | ||
| IntegerLiteralSeparator: | ||
| Binary: 4 | ||
| Decimal: 3 | ||
| Hex: 4 | ||
|
JoltedJon marked this conversation as resolved.
|
||
| BinaryMinDigitsInsert: 8 | ||
| DecimalMinDigitsInsert: 6 | ||
| HexMinDigitsInsert: 8 | ||
|
|
||
| KeepEmptyLines: | ||
| AtEndOfFile: false | ||
| AtStartOfBlock: false | ||
| AtStartOfFile: false | ||
|
|
||
| KeepFormFeed: false | ||
|
|
||
| # No Microslop BS \r\n | ||
|
Arctis-Fireblight marked this conversation as resolved.
|
||
| LineEnding: LF | ||
|
|
||
| NamespaceIndentation: None | ||
|
|
||
| NumericLiteralCase: | ||
| ExponentLetter: Leave | ||
| HexDigit: Lower | ||
| Prefix: Lower | ||
| Suffix: Upper | ||
|
|
||
| # TODO Use after upgrading to Clang 23 | ||
| # PackParameters: | ||
| # BinPack: OnePerLine | ||
|
|
||
| BinPackParameters: OnePerLine | ||
|
|
||
| QualifierAlignment: Right | ||
|
|
||
| ReflowComments: Never | ||
|
|
||
| RemoveBracesLLVM: false | ||
| RemoveEmptyLinesInUnwrappedLines: false | ||
| RemoveParentheses: Leave | ||
|
|
||
| RemoveSemicolon: false | ||
|
|
||
| RequiresExpressionIndentation: OuterScope | ||
|
|
||
| SeparateDefinitionBlocks: Leave | ||
|
|
||
| SkipMacroDefinitionBody: true | ||
|
|
||
| SortIncludes: | ||
| Enabled: false | ||
|
|
||
| SortUsingDeclarations: Never | ||
|
|
||
| SpaceAfterCStyleCast: false | ||
| SpaceAfterLogicalNot: false | ||
| SpaceAfterOperatorKeyword: false | ||
| SpaceAfterTemplateKeyword: false | ||
| SpaceAroundPointerQualifiers: Default | ||
|
|
||
| SpaceBeforeAssignmentOperators: true | ||
| SpaceBeforeCaseColon: false | ||
| SpaceBeforeCpp11BracedList: false | ||
| SpaceBeforeCtorInitializerColon: true | ||
| SpaceBeforeInheritanceColon: true | ||
| SpaceBeforeParens: ControlStatements | ||
|
|
||
| SpaceBeforeRangeBasedForLoopColon: true | ||
| SpaceBeforeSquareBrackets: false | ||
| SpaceInEmptyBraces: Always | ||
|
|
||
| SpacesInAngles: Leave | ||
|
|
||
| SpacesInContainerLiterals: false | ||
| SpacesInParens: Never | ||
| SpacesInSquareBrackets: false | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| build/* | ||
| engine/native/thirdparty/* |

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vote for pointer to the left (on the side of the type)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me, I tend to prefer
int* fooinstead ofint *foo