ソースを参照

Better adapt clang-format to current stack formatting and ignore deps in clang-format

Stefan Profanter 5 年 前
コミット
54ab94e860
共有2 個のファイルを変更した13 個の追加3 個の削除を含む
  1. 10 3
      .clang-format
  2. 3 0
      tools/travis/travis_linux_script.sh

+ 10 - 3
.clang-format

@@ -2,9 +2,16 @@
 Language:        Cpp
 BasedOnStyle:    llvm
 IndentWidth:     4
-ColumnLimit:     120
+ColumnLimit:     90
 SpacesBeforeTrailingComments: 2
-#SpaceBeforeRangeBasedForLoopColon: false
-#ForEachMacros:   [ foreach, LIST_FOREACH, LIST_FOREACH_SAFE ]
+ForEachMacros:   [ foreach, LIST_FOREACH, LIST_FOREACH_SAFE ]
 DisableFormat:   false
 
+# No space between if and parentheses
+SpaceBeforeParens: Never
+
+# Format function declarations
+BinPackParameters: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AlignAfterOpenBracket: Align
+AlwaysBreakAfterReturnType: All

+ 3 - 0
tools/travis/travis_linux_script.sh

@@ -109,6 +109,9 @@ if ! [ -z ${CLANG_FORMAT+x} ]; then
     # We want to get colored diff output into the variable
     git config color.diff always
 
+    # Ignore files in the deps directory diff by resetting them to master
+    git diff --name-only $TRAVIS_BRANCH | grep 'deps/*' | xargs git checkout $TRAVIS_BRANCH --
+
     # clang-format the diff to the target branch of the PR
     difference="$($LOCAL_PKG/bin/git-clang-format --style=file --diff $TRAVIS_BRANCH)"