Fmt: Introduce clang-format

Created on 3 Dec 2018  路  4Comments  路  Source: fmtlib/fmt

It would be really helpful. I think there should be a .clang-format file created and a cf version mentioned in the CONTRIBUTING.rst

Most helpful comment

Jonathan's .clang-format can be simplified to just

BasedOnStyle: Google
AlwaysBreakTemplateDeclarations: true

Enjoy!

All 4 comments

Sounds reasonable. I've been using .clang-format something like below.

Following links will be helpful.

BasedOnStyle: Google
Language: Cpp
Standard: Cpp11

UseTab: Never
IndentWidth: 4
ColumnLimit: 80
PointerAlignment: Left

AlignTrailingComments: true
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: true 

BreakBeforeBinaryOperators: true
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true

ConstructorInitializerAllOnOneLineOrOnePerLine: true
Cpp11BracedListStyle: true

IndentCaseLabels: false
IndentFunctionDeclarationAfterType: true
NamespaceIndentation: None

I've run https://github.com/johnmcfarlane/unformat and it created the following .clang-format file. It only did some minor changes to format.h, I recommend you try it out @vitaut.
clang-format.txt

(Had to rename the file for github)

Jonathan's .clang-format can be simplified to just

BasedOnStyle: Google
AlwaysBreakTemplateDeclarations: true

Enjoy!

Was this page helpful?
0 / 5 - 0 ratings