Skip to content

Commit

Permalink
Ref code style to use clang-format 17 options
Browse files Browse the repository at this point in the history
  • Loading branch information
gunvirranu committed Jan 30, 2024
1 parent 8126f35 commit 7c96c9e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 19 deletions.
64 changes: 46 additions & 18 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# Gunvir Singh Ranu
# Last Updated: 2024-01-29
# Options as of clang-format 19
# Commented out some currently unsupported by CLion

AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignConsecutiveMacros: Consecutive
AlignArrayOfStructures: Right
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: Consecutive
# AlignConsecutiveShortCaseStatements: true
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 1
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
# AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
# AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
Expand All @@ -20,8 +32,13 @@ AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
# BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeConceptDeclarations: Allowed
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
Expand All @@ -31,36 +48,51 @@ CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: false
PenaltyReturnTypeOnItsOwnLine: 500
DerivePointerAlignment: true
EmptyLineAfterAccessModifier: Leave
EmptyLineBeforeAccessModifier: Leave
FixNamespaceComments: true
IncludeBlocks: Preserve
IncludeIsMainRegex: '(test[-_])?$'
IncludeIsMainSourceRegex: '(\.hpp)$'
IndentAccessModifiers: false
IndentCaseBlocks: true
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: NoIndent
IndentGotoLabels: false
IndentPPDirectives: AfterHash
IndentRequiresClause: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: true
InsertNewlineAtEOF: true
# IntegerLiteralSeparator:
# Binary: 4
# Decimal: 3
# Hex: 4
# BinaryMinDigits: 8
# DecimalMinDigits: 5
# HexMinDigits: 8
# KeepEmptyLinesAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
Language: Cpp
LineEnding: LF
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
NamespaceIndentation: None
PPIndentWidth: 2
PackConstructorInitializers: NextLine
PenaltyReturnTypeOnItsOwnLine: 500
PointerAlignment: Right
QualifierAlignment: Left
ReflowComments: true
ReferenceAlignment: Right
SortIncludes: CaseInsensitive
ReferenceAlignment: Pointer
ReflowComments: false
# RemoveParentheses: MultipleParentheses
RemoveSemicolon: true
RequiresClausePosition: WithPreceding
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 10
SortUsingDeclarations: true
SortIncludes: CaseInsensitive
# SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
Expand All @@ -73,18 +105,14 @@ SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInAngles: Never
SpacesInContainerLiterals: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
#SpacesInParens: Never
SpacesInSquareBrackets: false
Standard: c++11
TabWidth: 4
UseCRLF: false
UseTab: Never
2 changes: 1 addition & 1 deletion tests/test_perturb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ TEST_CASE(
const auto JD_START = JulianDate(2415750.5); // Around start of 1901
const auto JD_END = JulianDate(2488068.5); // Around end of 2099

constexpr int N_CHECKS = 123479; // Shouldn't evenly divide range
constexpr int N_CHECKS = 123479; // Shouldn't evenly divide range
const double DELTA_JD = (JD_END - JD_START) / N_CHECKS;

for (int i = 0; i < N_CHECKS; ++i) {
Expand Down

0 comments on commit 7c96c9e

Please sign in to comment.