diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..d89c628 --- /dev/null +++ b/.clang-format @@ -0,0 +1,101 @@ +# +-------------+---------+-----------------------+ +# | John Breaux | jab0910 | JohnBreaux@my.unt.edu | +# +-------------+---------+-----------------------+ +# | Created 2022-04-23 | +# +-----------------------------------------------+ + +# Default to Google style +BasedOnStyle: Google + +# Don't derive from file +DeriveLineEnding: false +DerivePointerAlignment: false + +# Google limits lines to 80 columns. Don't do that. +ColumnLimit: 0 + +# Here there be controversy +IndentWidth: 3 +ConstructorInitializerIndentWidth: 3 +ContinuationIndentWidth: 3 + +# Alignment checks +AlignConsecutiveAssignments: true +AlignTrailingComments: true + +# Sort include blocks, and regroup based on include category +SortIncludes: CaseInsensitive +IncludeBlocks: Regroup + +# Allow short blocks on single line +AllowShortBlocksOnASingleLine: Always +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: AllIfsAndElse +AllowShortLambdasOnASingleLine: Inline +AllowShortLoopsOnASingleLine: true +# Except case statements +AllowShortCaseLabelsOnASingleLine: false + +# Line wrapping should not happen, but just in case, keep the args together +BinPackArguments: true +BinPackParameters: true + +# When bitfield-packing a struct, spaces go after the colon, not before +BitFieldColonSpacing: After + +# By default, braces are obnoxiously wrapped to newlines +BreakBeforeBraces: Custom +# Disable that +BraceWrapping: + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + AfterControlStatement: false + + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + + IndentBraces: false + + SplitEmptyFunction: false + +# Don't break before ?:, it looks ugly +BreakBeforeTernaryOperators: false + +# Trim empty lines when there are more than 1 +MaxEmptyLinesToKeep: 1 + +# Align &*s toward the variable name (i.e. int &number; char *cstring) +ReferenceAlignment: Pointer +PointerAlignment: Right + +# Put spaces after (int) c_style_casts and template , but !after '!' operator +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true + +# Put spaces before \.?\= operators, initializer {lists}, inline (parentheses), // comments. +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: true +SpaceBeforeParens: Always +SpacesBeforeTrailingComments: 1 +SpacesInLineCommentPrefix: + Minimum: 1 +# Don't put spaces in case : statements, object : inheritance, +# for (auto& loops : range), conditional ( statements ), ( parentheses ), [ brackets ] +SpaceBeforeCaseColon: false +SpaceBeforeInheritanceColon: false +SpaceBeforeRangeBasedForLoopColon: false +SpacesInConditionalStatement: false +SpacesInParentheses: false +SpacesInSquareBrackets: false + +# Always use LF for line breaks, and NEVER use tabs for indentation +UseCRLF: false +UseTab: Never