clang-formatによるコーディング規約の統一化
チーム内でコーディング規約を統一するために、
設定ファイルに従って、自動でソースを整形してくれる
clang-formatツールを使用する。
以下が、設定ファイルの記載例
---
#BasedOnStyle: Google
#コメントを末尾に揃える
AlignTrailingComments: true
#AlignConsecutiveAssignments: true
AccessModifierOffset: -4
#ConstructorInitializerIndentWidth: 4
#AlignEscapedNewlinesLeft: true
#AllowAllParametersOfDeclarationOnNextLine: true
#AllowShortIfStatementsOnASingleLine: true
#AllowShortLoopsOnASingleLine: true
#AlwaysBreakTemplateDeclarations: true
#AlwaysBreakBeforeMultilineStrings: true
#BreakBeforeBinaryOperators: false
#BreakBeforeTernaryOperators: true
#BreakConstructorInitializersBeforeComma: false
#
#関数呼び出しや関数定義のパラメーターを、一行ごとにするか
BinPackParameters: true
#ColumnLimit: 80
#ConstructorInitializerAllOnOneLineOrOnePerLine: true
#DerivePointerBinding: true
#ExperimentalAutoDetectBinPacking: false
#switch ブロック内の case X: 文をインデント
IndentCaseLabels: true
#MaxEmptyLinesToKeep: 1
#
#Namespace のインデント(None:インデントしない)
NamespaceIndentation: None
#ObjCSpaceBeforeProtocolList: false
#PenaltyBreakBeforeFirstCallParameter: 1
#PenaltyBreakComment: 60
#PenaltyBreakString: 1000
#PenaltyBreakFirstLessLess: 120
#PenaltyExcessCharacter: 1000000
#PenaltyReturnTypeOnItsOwnLine: 200
#PointerBindsToType: true
#SpacesBeforeTrailingComments: 2
#Cpp11BracedListStyle: true
Standard: Auto
#インデントに使用する列数
IndentWidth: 4
#TabWidth: 8
#タブの使い方(Never:タブを使わない)
UseTab: Never
#波括弧{}のフォーマットスタイル(Allman:常に波括弧{}の前で改行)
BreakBeforeBraces: Allman
#IndentFunctionDeclarationAfterType: true
#SpacesInParentheses: false
#SpacesInAngles: false
#SpaceInEmptyParentheses: false
#SpacesInCStyleCastParentheses: false
#SpaceAfterControlStatementKeyword: true
#SpaceBeforeAssignmentOperators: true
#ContinuationIndentWidth: 4
#PointerAlignment:'Left'
...