-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds clang-format configuration and scripts for formatting (#605)
This commit adds the following: * A .clang-format file for configuring formatting * A script for autoformatting with clang-format * A Dockerfile for running the autoformatting script with clang-format 17.0.6 * A script for building and running the autoformatting Dockerfile * A script for checking formatting with clang-format * A Dockerfile for running the format check script with clang-format 17.0.6 * A script for building and running the format check Dockerfile * A GitHub Actions CI file for checking formatting * The results of reformatting the repo
- Loading branch information
Showing
337 changed files
with
17,798 additions
and
18,756 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
--- | ||
BasedOnStyle: Microsoft | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: BlockIndent | ||
AlignArrayOfStructures: None | ||
AlignConsecutiveAssignments: | ||
Enabled: true | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: true | ||
AlignConsecutiveBitFields: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: false | ||
AlignConsecutiveDeclarations: | ||
Enabled: true | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: false | ||
AlignConsecutiveMacros: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: Align | ||
AlignTrailingComments: | ||
Kind: Always | ||
OverEmptyLines: 0 | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortEnumsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: InlineOnly | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLambdasOnASingleLine: Inline | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: Yes | ||
AttributeMacros: | ||
- __capability | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BitFieldColonSpacing: Both | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: true | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterObjCDeclaration: true | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: true | ||
BeforeCatch: false | ||
BeforeElse: false | ||
BeforeLambdaBody: false | ||
BeforeWhile: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
BreakAfterAttributes: Never | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakArrays: false | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeBraces: Custom | ||
BreakBeforeConceptDeclarations: Always | ||
BreakBeforeInlineASMColon: OnlyMultiline | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeColon | ||
BreakInheritanceList: BeforeColon | ||
BreakStringLiterals: true | ||
ColumnLimit: 120 | ||
CommentPragmas: ^\\.+ | ||
CompactNamespaces: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: false | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
EmptyLineAfterAccessModifier: Always | ||
EmptyLineBeforeAccessModifier: Always | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IfMacros: | ||
- KJ_IF_MAYBE | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: ^"(llvm|llvm-c|clang|clang-c)/ | ||
Priority: 2 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: ^(<|"(gtest|gmock|isl|json)/) | ||
Priority: 3 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: .* | ||
Priority: 1 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
IncludeIsMainRegex: (Test)?$ | ||
IncludeIsMainSourceRegex: "" | ||
IndentAccessModifiers: false | ||
IndentCaseBlocks: true | ||
IndentCaseLabels: false | ||
IndentExternBlock: NoIndent | ||
IndentGotoLabels: false | ||
IndentPPDirectives: None | ||
IndentRequiresClause: true | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
InsertBraces: false | ||
InsertNewlineAtEOF: false | ||
InsertTrailingCommas: None | ||
IntegerLiteralSeparator: | ||
Binary: 0 | ||
Decimal: 0 | ||
Hex: 0 | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
LambdaBodyIndentation: Signature | ||
Language: Cpp | ||
LineEnding: DeriveLF | ||
MacroBlockBegin: "" | ||
MacroBlockEnd: "" | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Auto | ||
ObjCBlockIndentWidth: 2 | ||
ObjCBreakBeforeNestedBlockParam: true | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PPIndentWidth: -1 | ||
PackConstructorInitializers: NextLine | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakOpenParenthesis: 0 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyIndentedWhitespace: 0 | ||
PenaltyReturnTypeOnItsOwnLine: 1000 | ||
PointerAlignment: Left | ||
QualifierAlignment: Leave | ||
ReferenceAlignment: Pointer | ||
ReflowComments: false | ||
RemoveBracesLLVM: false | ||
RemoveSemicolon: false | ||
RequiresClausePosition: OwnLine | ||
RequiresExpressionIndentation: OuterScope | ||
SeparateDefinitionBlocks: Always | ||
ShortNamespaceLines: 1 | ||
SortIncludes: Never | ||
SortJavaStaticImport: Before | ||
SortUsingDeclarations: LexicographicNumeric | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceAroundPointerQualifiers: Default | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCaseColon: false | ||
SpaceBeforeCpp11BracedList: true | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: Custom | ||
SpaceBeforeParensOptions: | ||
AfterControlStatements: true | ||
AfterForeachMacros: true | ||
AfterFunctionDeclarationName: false | ||
AfterFunctionDefinitionName: false | ||
AfterIfMacros: true | ||
AfterOverloadedOperator: true | ||
AfterRequiresInClause: false | ||
AfterRequiresInExpression: false | ||
BeforeNonEmptyParentheses: false | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: Never | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInConditionalStatement: false | ||
SpacesInContainerLiterals: true | ||
SpacesInLineCommentPrefix: | ||
Minimum: 1 | ||
Maximum: -1 | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: c++11 | ||
StatementAttributeLikeMacros: | ||
- Q_EMIT | ||
StatementMacros: | ||
- Q_UNUSED | ||
- QT_REQUIRE_VERSION | ||
TabWidth: 4 | ||
UseTab: Never | ||
WhitespaceSensitiveMacros: | ||
- BOOST_PP_STRINGIZE | ||
- CF_SWIFT_NAME | ||
- NS_SWIFT_NAME | ||
- PP_STRINGIZE | ||
- STRINGIZE |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Check code formatting | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
cpp-format-check: | ||
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install clang-format | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
clang-format-17 | ||
- name: Test formatting | ||
run: | | ||
./scripts/formatting/check-formatting.sh /usr/bin/clang-format-17 |
This file contains 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
This file contains 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
Oops, something went wrong.