From 2140e4696f8b64fb5672ee72d404e4611a4e3e9b Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 9 Apr 2023 14:44:26 -0400 Subject: [PATCH] Initial commit --- .clang-format.yaml | 163 +++++++++++++++++++++++++++++++++++++++++++++ .editorconfig | 3 + Readme.md | 4 ++ clang-format.ps1 | 17 +++++ 4 files changed, 187 insertions(+) create mode 100644 .clang-format.yaml create mode 100644 .editorconfig create mode 100644 Readme.md create mode 100644 clang-format.ps1 diff --git a/.clang-format.yaml b/.clang-format.yaml new file mode 100644 index 0000000..f33a4e6 --- /dev/null +++ b/.clang-format.yaml @@ -0,0 +1,163 @@ +# Format Style Options - Created with Clang Power Tools +--- +AccessModifierOffset: -4 + +AlignAfterOpenBracket: BlockIndent +AlignArrayOfStructures: Right +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + AlignCompound: true + PadOperators: true +AlignConsecutiveBitFields: AcrossComments +AlignConsecutiveDeclarations: AcrossComments +AlignConsecutiveMacros: AcrossComments +AlignEscapedNewlines: Right +AlignOperands: DontAlign + +AlignTrailingComments: true + +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortLambdasOnASingleLine: None +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false + +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes + +BinPackArguments: false +BinPackParameters: false + +BitFieldColonSpacing: Both + +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false + BeforeLambdaBody: false + BeforeWhile: false + +# BreakAfterAttributes: Always +# BreakArrays: false +# BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Allman +BreakBeforeInheritanceComma: true +BreakInheritanceList: BeforeComma +BreakBeforeConceptDeclarations: true +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeComma +BreakStringLiterals: true + +ColumnLimit: 180 + +CompactNamespaces: true + +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth : 4 + +ContinuationIndentWidth: 4 + +Cpp11BracedListStyle: false + +DeriveLineEnding: true + +ExperimentalAutoDetectBinPacking: false + +FixNamespaceComments: true + +IncludeBlocks: Preserve + + +IndentCaseBlocks: true +IndentCaseLabels: true +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: AfterHash +IndentRequires: true +IndentWidth: 4 +IndentWrappedFunctionNames: false + +# InsertNewlineAtEOF: true +InsertTrailingCommas: Wrapped + +LambdaBodyIndentation: OuterScope + +Language: Cpp + +MaxEmptyLinesToKeep: 4 + +NamespaceIndentation: All + +PointerAlignment: Left + +QualifierAlignment: Leave + +ReferenceAlignment: Left + +ReflowComments: true + +# RequiresExpressionIndentation: OuterScope + +SeparateDefinitionBlocks: Always + +ShortNamespaceLines: 40 + +SortIncludes: true +SortUsingDeclarations: true + +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: true +SpaceAfterTemplateKeyword: false + +SpaceAroundPointerQualifiers: Default + +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: true +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatementsExceptControlMacros +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpacesBeforeTrailingComments: 4 + +SpaceInEmptyBlock: true +SpaceInEmptyParentheses: false +SpacesInAngles: true +SpacesInCStyleCastParentheses: true +SpacesInConditionalStatement: true +SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: 20 +SpacesInParentheses: true +SpacesInSquareBrackets: true + +Standard: c++17 + +TabWidth: 4 + +UseTab: ForIndentation +... diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..62c125a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.yaml] +tab_width = 2 +indent_style = space diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..f771441 --- /dev/null +++ b/Readme.md @@ -0,0 +1,4 @@ +# Code Format Styling + +This is just a repo containing my personal clang format configuration, along with scripts for using it. + diff --git a/clang-format.ps1 b/clang-format.ps1 new file mode 100644 index 0000000..3416ea4 --- /dev/null +++ b/clang-format.ps1 @@ -0,0 +1,17 @@ +[string[]] $include = '*.h', '*.hh', '*.hpp', '*.c', '*.cc', '*.cpp' +[string[]] $exclude = '' + +Write-Host "Beginning format...`n" + +# Format the files. +$formatParams = @( + '-i' # In-place + '-style=file' # Search for a .clang-format file in the parent directory of the source file. + '-verbose' +) + +$targetFiles = @(Get-ChildItem -Recurse -Path $path_test -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName) + +clang-format $formatParams $targetFiles + +Write-Host "`nFormatting complete"