From b0e4c216b3c3e52f18427314fe69b2ec2b2d5135 Mon Sep 17 00:00:00 2001 From: Subhransu Mohanty Date: Mon, 31 Aug 2020 11:08:43 +0900 Subject: [PATCH] clang-format: added .clang-format with rules adhere to dali coding guidelines. added ./format file which will apply the coding guideline to the latest commit at HEAD^ and reformats the files if it violates Dali style guideline. Change-Id: Ic265bdab2f43123eba72dd3317f2fda39248c2e4 --- .clang-format | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ format | 1 + 2 files changed, 97 insertions(+) create mode 100644 .clang-format create mode 100755 format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..f983424 --- /dev/null +++ b/.clang-format @@ -0,0 +1,96 @@ +--- +Language: Cpp +BasedOnStyle: Google +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: true + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true +SpacesInConditionalStatement : true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +ConstructorInitializerAllOnOneLineOrOnePerLine: true +AllowAllConstructorInitializersOnNextLine : false +ConstructorInitializerIndentWidth: 0 +ColumnLimit: 0 +CommentPragmas: '^ IWYU pragma:' +ContinuationIndentWidth: 2 +Cpp11BracedListStyle: true +DerivePointerAlignment: true +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +SpaceBeforeCtorInitializerColon: false +IndentCaseLabels: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Right +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: Never +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceAfterTemplateKeyword: false +Standard: Auto +TabWidth: 2 +UseTab: Never +... diff --git a/format b/format new file mode 100755 index 0000000..c5630b4 --- /dev/null +++ b/format @@ -0,0 +1 @@ +git diff -U0 --no-color HEAD^ | clang-format-diff -i -p1 \ No newline at end of file -- 2.7.4