Skip to content

Support clang-format configuration file #52

@geraldolsribeiro

Description

@geraldolsribeiro

If there exists a file .clang-format at root of the project, use it.

Sample of configuration file:

Language: Cpp
BasedOnStyle: Google
#BasedOnStyle: WebKit
#AlignConsecutiveAssignments: AcrossEmptyLinesAndComments
#AlignConsecutiveAssignments: Consecutive
AlignConsecutiveAssignments: false
#AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignTrailingComments: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
BreakConstructorInitializersBeforeComma: true
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
#BinPackParameters: BinPack
BinPackArguments: true
BreakBeforeBraces: Attach
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
#ColumnLimit: 100
ColumnLimit: 140
Cpp11BracedListStyle: true
SpaceBeforeCpp11BracedList: true
EmptyLineBeforeAccessModifier: LogicalBlock
FixNamespaceComments: true
IndentWidth: 2
MaxEmptyLinesToKeep: 1
#ReflowComments: false
DerivePointerAlignment: false
ReferenceAlignment: Left
PointerAlignment: Left
ReflowComments: true
TabWidth: 2
UseTab: Never
IncludeBlocks: Regroup
SortIncludes: true
IncludeCategories:
  # Headers in <> without extension.
  - Regex:           '<([A-Za-z0-9\Q/-_\E])+>'
    Priority:        4
  # Headers in <> from specific external libraries.
  - Regex:           '<(catch2|boost)\/'
    Priority:        3
  # Headers in <> with extension.
  - Regex:           '<([A-Za-z0-9.\Q/-_\E])+>'
    Priority:        2
  # Headers in "" with extension.
  - Regex:           '"([A-Za-z0-9.\Q/-_\E])+"'
    Priority:        1

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions